Submission #37353

# Submission time Handle Problem Language Result Execution time Memory
37353 2017-12-24T14:46:22 Z IvanC Savrsen (COCI17_savrsen) C++14
120 / 120
2223 ms 50844 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e7 + 2;
bool primo[MAXN];
int vetor[MAXN];
int main(){
	int A,B;
	scanf("%d %d",&A,&B);
	for(int i = 1;i<=B;i++) vetor[i] = i;
	long long resposta = 0;
	for(int i = 1;i<=B;i++){
		if(i >= A) resposta += abs(vetor[i]);
		for(int j = 2*i;j<=B;j+=i){
			vetor[j] -= i;
		}
	}
	printf("%lld\n",resposta);
	return 0;
}

Compilation message

savrsen.cpp: In function 'int main()':
savrsen.cpp:8:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&A,&B);
                      ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 50844 KB Output is correct
2 Correct 0 ms 50844 KB Output is correct
3 Correct 3 ms 50844 KB Output is correct
4 Correct 2216 ms 50844 KB Output is correct
5 Correct 2223 ms 50844 KB Output is correct
6 Correct 2189 ms 50844 KB Output is correct
7 Correct 1879 ms 50844 KB Output is correct
8 Correct 179 ms 50844 KB Output is correct