纯C
这题老老实实的做没有做对,然后就投机取消了,牛客的测试集覆盖的不全面啊!
#include <stdlib.h> #include <stdio.h> int main() { int n; while(scanf("%d", &n) != EOF) { int cnt=0, square=0; for(int i=0; i<=n; i++) { square = i*i; if(square%10000 == i || square%1000 == i || square%100 == i || square%10 == i) { cnt++; } } printf("%d\n", cnt); } return 0; }