A. Yet Another Two Integers Problem(Codeforces Round #667 (Div. 3))

在这里插入图片描述
这就是一个水题,划水中!!

#include<bits/stdc++.h>
using namespace std;
int main()
{
    
    
    int t;cin>>t;
    while(t--){
    
    
        int a,b; cin>>a>>b;
        int ans = abs((a-b)/10);
        if(abs((a-b)%10)) ans++;
        cout<<ans<<endl;
    }
    return 0;
}

python代码:

from math import *
 
t = int(input())
for i in range(t):
    a,b = map(int,input().split())
    print(ceil(abs(a-b)/10))

这里面用了一个ceil函数。
ceil()函数向上舍入最接近的整数。

猜你喜欢

转载自blog.csdn.net/qq_43811879/article/details/108780860