为啥会TLE呢?求大神kk

P1980 [NOIP2013 普及组] 计数问题

希更展?使[Md](https://www.luogu.org/wiki/show?name=%E5%B8%AE%E5%8A%A9%EF%BC%9Amarkdown)
by ferrum_cccp @ 2019-04-23 23:28:12


``` #include <iostream> using namespace std; int main() { long long n, x, di, count = 0; cin >> n >> x; for (int i = 1; i <= n; i++) { di = i; while (di) { if (di % 10 == x) { count++; } di /= 10; } } cout << count << endl; return 0; } ``` 就是这样,就不会TLE了^_^
by hantingsheng @ 2019-05-22 10:35:22


|