Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
44727 wuxinyue 数字统计 C++ Accepted 1 MS 244 KB 287 2024-04-02 20:32:11

Tests(1/1):


#include <bits/stdc++.h> using namespace std; int main(){ int a,b,sum = 0;; cin >> a; cin >> b; for(int i = a;i <= b;i ++){ if(i % 10 == 2){ sum ++; } if(i /10 % 10 == 2){ sum ++; } if(i /100 % 10 == 2){ sum ++; } } cout << sum; return 0; }


Judgement Protocol: