Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
4271 罗炜翰 数1的个数 C++ Accepted 100 0 MS 260 KB 242 2025-01-05 17:25:57

Tests(5/5):


#include<iostream> using namespace std; int main() { int n,a,g,s; cin>>n; a = 0; for (int i = 1;i <= n;i ++) { s = i; while(s != 0){ if (s % 10 == 1) { a++; } s /= 10; } } cout<<a<<endl; }


Judgement Protocol: