- 含k个3的数
对了9个,哪错了?
- 2023-12-13 20:20:49 @
~~~#include <bits/stdc++.h>
using namespace std;
int main()
{ long long m,k,c=0,d,z;
cin>>m>>k;
z=m;
while(z>0){
d=z%10;
z/=10;
if(d==3)c++;
}
if(c==k||m%19==0)cout<<"YES";
else if(c!=k&&m%19!=0)cout<<"NO";
return 0;
}
2 comments
-
经开一中2026届11班关泽瑞 LV 6 @ 2023-12-13 20:36:01
你那个有点麻烦,应该废了
-
2023-12-13 20:34:36@
#include <bits/stdc++.h> using namespace std; int main() { int m,k,n=0,a; cin >> m >> k; if(m%19==0) { while (m!=0) { a=m%10; if(a==3) n++; m=m/10; } if(n==k) cout << "YES" << endl; } else cout << "NO" << endl; return 0; }
- 1
Information
- ID
- 584
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 2
- Tags
- (None)
- # Submissions
- 118
- Accepted
- 70
- Uploaded By