提交时间:2023-11-02 18:58:38

运行 ID: 29729

#include<iostream> using namespace std; int f(int x) { static int m = 0;//注意,这里使用了静态局部变量,否则每次载入递归函数,m会被重置 if (x % 10 == 3) //对正整数求模,相当于从最后一位开始判断是否为3 { m++; } if ((x / 10) != 0) { f(x / 10); } else return m; } int main() { int a , b = 0; cin >> a >> b; if (a % 19 == 0) { if (f(a) == 3) { cout << "yes"; } else (cout << "no"); } else (cout << "no"); }