标签:
6 1 3 4 6 7 999999999
1: 1 3: 2 4: 3 6: 4 7: 5 999999999: 40353606// Problem#: 1780 // Submission#: 3708249 // The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License // URI: http://creativecommons.org/licenses/by-nc-sa/3.0/ // All Copyright reserved by Informatic Lab of Sun Yat-sen University #include<iostream> #include<cstdio> #include<cctype> #include<iomanip> #include<vector> #include<cstring> #include<string> #include<fstream> #include<stack> #include<vector> #include<algorithm> #include<cmath> using namespace std; int check(int n){ if(n<2) return 0; else if(n<5) return 1; else if(n<8) return 2; else return 3; } int main(){ int n; cin>>n; int s[10]={0,3,51,657,7599,83193,882351,9176457,94235199,959646393}; while(n--){ int t; cin>>t; int ans=0; int k=1,m=0; int tem=t; while(t){ int tem=0; tem+=check(t%10); t/=10; tem+=t*3; tem*=(k-s[m]); ans+=tem; k*=10; m++; } cout<<tem<<": "<<tem-ans<<endl; } }
Sicily 1780. Faulty Odometer Again
标签:
原文地址:http://blog.csdn.net/christophe123/article/details/45335671