Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
4356 A班-过懿萱 数1的个数 C++ 通过 100 2 MS 256 KB 291 2025-01-11 11:37:05

Tests(5/5):


#include <bits/stdc++.h> using namespace std; int main() { int n,count = 0; cin>>n; for(int i = 1;i <= n;i++) { int temp = i; while(temp != 0) { int p = temp % 10; if (p == 1) { count++; } temp /= 10; } } cout<<count<<endl; return 0; }


测评信息: