1 solutions
-
0
C :
#include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> #include <string.h> int main() { //freopen("in","r",stdin); // freopen("out","w",stdout); int n ; int count,i; while(scanf("%d",&n)!=EOF) { count =0; for(i=1;i<=n;i++) { if((i % 7 == 0 || i % 11 ==0) ) { if(i%7 == 0 && i % 11==0) continue; else count++; } } printf("%d\n",count); } return 0; }C++ :
#include<iostream> using namespace std; int main() { int i; int n; while(cin>>n) { int sum=0; for(i=1;i<=n;i++) { if(i%7==0 || i%11==0 ) { if(i%7==0 && i%11==0); else sum++; } } cout<<sum<<endl; } return 0; }
- 1
Information
- ID
- 18210
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By