Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
314233 | 胡芷萱 | NOIP2010 普及:第一题 数字统计 | C++ | 通过 | 100 | 0 MS | 268 KB | 275 | 2024-12-12 17:29:01 |
#include <bits/stdc++.h> using namespace std; int main() { int i,a,j,l,r,s=0; scanf ("%d%d",&l,&r); for (int i=l;i<=r;i++) { a=i; do { j=a%10; a=a/10; if (j==2) { s++; } } while (a!=0); } printf("%d",s); return 0; }