用户输出
328
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#25374 | #1140. ddd和骡马 | Accepted | 100 | 28 ms | 360 K | C++ / 383 B | lvcs | 2020-04-26 22:39:20 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, sum[105], ans;
ll chai(ll x) {
ll s = 0;
while (x) {
s += x % 10;
x /= 10;
}
return s;
}
int main() {
cin >> n;
for (int i = 1; i <= n; ++i) ++sum[chai(i)];
for (int i = 1; sum[i]; ++i) {
ans += sum[i] * sum[i];
}
cout << ans;
return 0;
}