답안 #42368

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
42368 2018-02-26T14:06:33 Z milmillin Savrsen (COCI17_savrsen) C++14
120 / 120
2137 ms 78876 KB
#include <cstdio>

using namespace std;

long long tbl[10000100];

int main () {
	for (int i=1;i<10000100;i++) {
		tbl[i]=i;
	}
	for (int i=1;i<10000100;i++) {
		for (int j=i+i;j<10000100;j+=i) {
			tbl[j]-=i;
		}
	}
	int a,b;
	scanf("%d%d",&a,&b);
	long long sum=0;
	for (int i=a;i<=b;i++) {
		if (tbl[i]<0) tbl[i]=-tbl[i];
		sum+=tbl[i];
	}
	printf("%lld\n",sum);
	return 0;
}

Compilation message

savrsen.cpp: In function 'int main()':
savrsen.cpp:17:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&a,&b);
                     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2137 ms 78592 KB Output is correct
2 Correct 2068 ms 78592 KB Output is correct
3 Correct 2089 ms 78612 KB Output is correct
4 Correct 2048 ms 78868 KB Output is correct
5 Correct 2099 ms 78868 KB Output is correct
6 Correct 2108 ms 78868 KB Output is correct
7 Correct 2121 ms 78868 KB Output is correct
8 Correct 2119 ms 78876 KB Output is correct