1 solutions
-
0
C :
#include<stdio.h> int main(){ int n,i,c=0; scanf("%d",&n); for(i = 1;i <= n;i++){ if( i % 3 == 2 && i % 5 == 3 && i % 7 == 2){ c++; } } printf("%d",c); return 0; }
C++ :
#include <iostream> using namespace std; int main(){ int n,i,a; a=0; cin>>n; for(i=1;i<=n;i++){ if(i%3==2&&i%5==3&&i%7==2){ a++; } } cout<<a<<endl; }
Python :
i=1 s=0 n=int(input()) while i<=n: a=i//1000 b=i//100%10 c=i//10%10 d=i%10 if i%3==2 and i%5==3 and i%7==2: s+=1 i+=1 print(s)
- 1
Information
- ID
- 10845
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By