A B 尾數不等a b問題

2021-07-02 11:40:28 字數 673 閱讀 9016

/*problem description

讀入兩個小於

10000

的正整數a和

b,計算

a+b。需要注意的是:如果a和

b的末尾

k(不超過

8)位數字相同,請直接輸出-1。

input

測試輸入包含若干測試用例,每個測試用例佔一行,格式為

"a b k"

,相鄰兩數字有乙個空格間隔。當a和

b同時為

0時輸入結束,相應的結果不要輸出。

output

對每個測試用例輸出

1行,即

a+b的值或者是-1。

sample input

1 2 1

11 21 1

108 8 2

36 64 3

0 0 1

sample output 3

-1 -1

100 */

#includeusing namespace std;

int main()

{ int a,b,k;

while(cin>>a>>b>>k)

{ if(a==0&&b==0)

break;

int i;

int sum=1;

for(i=0;i

A B 字串a b問題

problem description 讀入兩個小於100的正整數a和b,計算a b.需要注意的是 a和b的每一位數字由對應的英文單詞給出.input 測試輸入包含若干測試用例,每個測試用例佔一行,格式為 a b 相鄰兩字串有乙個空格間隔.當a和b同時為0時輸入結束,相應的結果不要輸出.output...

A B問題及擴充套件

位運算加法 擴充套件減乘除 給出兩個整數a和b,求它們的和 如果a 1並且b 2,返回3.你可以直接使用return a b,但是不使用 運算子 二進位制00000110 6 00001011 11 按位與運算 00000110 00001011 00000010總結 同為1則為1,否則為0 按位或...

ab常見問題彙總

測試伺服器ab 被測試伺服器apache apache版本2.2.25 問題一 socket too many open files 24 解決 在測試伺服器操作 1 檢視當前系統設定 open files n 1024為1024 root localhost ulimit a core file ...