# 10055 - Hashmat the Brave Warrior > 作者: Aria > 2023/10/24 ## C語言 ### 注意觀念 1. 印出long long int => %lld 2. 印出unsigned long long => %llu 3. 數字正數且不超過2的63次方時, 使用long long int 4. unsigned long long=[0,(2^64)-1] 5. long long int=[-((2^63)-1),+(2^63)+1] ![](https://hackmd.io/_uploads/ryYGs1NfT.png)[2] ### 程式碼 ``` #include<stdio.h> #include<stdlib.h> unsigned long long different(unsigned long long a,unsigned long long b){ if(a>b) return a-b; else if (a<b) return b-a; } int main(){ unsigned long long a=0,b=0,output=0; while(scanf("%llu %llu",&a,&b)==2){ output=different(a,b); if(output>=0) printf("%llu\n",output); } return 0; } ``` ## Reference: [1] 題目來源:[高中生程式解題系統](https://zerojudge.tw/ShowProblem?problemid=a012) [2] [Programming languages -- C](https://port70.net/~nsz/c/c11/n1570.html#5.2.4.2.1)
{"description":"當要印出long long int時,必須將%d改成%lld","title":"{C語言-1}10055 - Hashmat the Brave Warrior","contributors":"[{\"id\":\"e3f8038a-eab2-465a-8c92-a7303278b4c7\",\"add\":1223,\"del\":411}]"}
Expand menu