标签:题解 cin .net bsp str ret 数字 def namespace
具体题解发一下大佬的分析http://blog.csdn.net/wyg1997/article/details/52169036
1 #include <iostream> 2 #include <algorithm> 3 using namespace std; 4 typedef long long LL; 5 6 int main(){ 7 std::ios::sync_with_stdio(false); 8 int n; 9 cin >> n; 10 LL ans = 0; 11 int tn = n; 12 int mu = 1; 13 while (tn) 14 { 15 int t = tn % 10; 16 if (t == 0) 17 ans += (n / (mu * 10))*mu; 18 else if (t == 1) 19 { 20 ans += (n / (mu * 10))*mu; 21 ans += (n%mu) + 1; 22 } 23 else 24 ans += (n / (mu * 10) + 1)*mu; 25 tn /= 10; 26 mu *= 10; 27 } 28 cout << ans << endl; 29 return 0; 30 }
标签:题解 cin .net bsp str ret 数字 def namespace
原文地址:http://www.cnblogs.com/jaydenouyang/p/8001170.html