其他分享
首页 > 其他分享> > Interesting Function

Interesting Function

作者:互联网

#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
ll solve(int n){
    ll ans=0;
    for(int i=1;i<=10;i++)
        ans+=n/(int)(pow(10,i-1));
    return ans;
}
int main()
{
    ios::sync_with_stdio(false);
    int l,r;
    int t;cin>>t;
    while(t--){
        cin>>l>>r;
        cout<<solve(r)-solve(l)<<endl;
    }
}
View Code

 

标签:Function,std,int,Interesting,ll,long,using
来源: https://www.cnblogs.com/qq1415584788/p/14874662.html