Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
333963 | 黄浙峰老师 | 【C6-6】求各位数字之和 | C++ | 通过 | 100 | 1 MS | 240 KB | 180 | 2025-07-17 09:58:54 |
#include<bits/stdc++.h> using namespace std; int f(int n){ if(n>0) return f(n/10)+n%10; else return 0; } int main(){ int n; cin>>n; cout<<f(n); return 0; }