这咋还编译错误啊???
查看原帖
这咋还编译错误啊???
1142704
Ye_Cha楼主2024/5/19 12:46
#include<cstdio>  
#include<iostream>
#include<string>
using namespace std;
int main()
{   
    int l, r,count=0;
    char s[100009];
    cin >> l >> r;
    for (int i = l; i <= r; i++)
    {
        sprintf(s, "%d", i);
        size_t len = strlen(s);
        for (int j = 0; j < len; j++)
        {
            if (s[j] == '2')count += 1;
        }
    }   
    printf("%d", count);
    return 0;
}            
2024/5/19 12:46
加载中...