标签:style == main 图片 opened lap space 数字 closed
1 #include <iostream> 2 using namespace std; 3 4 long long f(int x ) 5 { 6 long long tot = 0; 7 while(x) 8 { 9 tot += x % 10; 10 x /= 10; 11 } 12 return tot; 13 } 14 15 int n , cnt[500]; 16 long long sum[500]; 17 long long ans = 1e18; 18 19 int main() 20 { 21 cin >> n ; 22 for(int i = 1; i<= 600000; i++) 23 { 24 int x = f(i); 25 if(cnt[x] < n ) 26 { 27 cnt[x]++; 28 sum[x] +=i; 29 30 } 31 if(cnt[x] == n ) 32 ans = min(ans, sum[x]); 33 34 } 35 printf("%lld",ans); 36 37 38 39 40 return 0; 41 }
标签:style == main 图片 opened lap space 数字 closed
原文地址:https://www.cnblogs.com/leoaioliabao/p/14534896.html