// ###
// #---##
// ####-0----##
// ####--------#
// #--------#
// ##-------#
// #-------#
// #-------#
// ##--------#
// #---------# #####
// #-------##-------####### Ya katala
// #------#----------------#
// #------##-----------------#
// #------##------------------#
// #-----#---------------------#
// #-----##---------------------#
// #------##--------------------#
// #-------##-------------------#
// #--------##------------------#
// ############################ #
// || ||
// || ||
// || ||
// || ||
// ####| ####|
#include <bits/stdc++.h>
#include <iostream>
#define for0(i , v) for (int i = 0 ; i < v.size() ; i++)
#define for1(i , n) for (int i = 1 ; i <= n ; i++)
#define AIDS ios_base::sync_with_stdio(0)
#define pb push_back
#define pp pop_back
#define sz(a) a.size()
#define all(x) x.begin() , x.end()
#define F first
#define S second
#define mp make_pair
#define ld long double
#define ll long long
#define pii pair<int, int>
#define in insert
#define vi vector <int>
#define vvi vector <vi>
#define Case "Case " << num << ": "
const int N = 1e6 + 3;
const ll INF = 1e18 + 100;
const int inf = 1e9 + 123;
const int MOD = 1e9 + 7;
const int dx[] = {0 , 1 , 0 , -1 , 0};
const int dy[] = {0 , 0 , 1 , 0 , -1};
const char dd[] = {' ' , 'D' , 'R' , 'U' , 'L'};
using namespace std;
ll sum[100000123];
void resheto() {
for (int i = 2 ; i <= 10000000 ; i++) {
for (int j = i + i ; j <= 10000000 ; j++) {
sum[j] += i;
}
}
}
main () {
// freopen("input.in", "r", stdin);
// freopen("output.out", "w", stdout);
AIDS;
int a , b;
cin >> a >> b;
resheto();
ll cnt = 0;
sum[1] = 1;
sum[2] = 1;
for (int i = a ; i <= b ; i++) {
cnt += abs(i - sum[i] - 1);
}
cout << cnt;
}
Compilation message
savrsen.cpp:71:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main () {
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3040 ms |
78584 KB |
Time limit exceeded |
2 |
Execution timed out |
3016 ms |
78760 KB |
Time limit exceeded |
3 |
Execution timed out |
3095 ms |
78760 KB |
Time limit exceeded |
4 |
Execution timed out |
3032 ms |
78760 KB |
Time limit exceeded |
5 |
Execution timed out |
3013 ms |
78760 KB |
Time limit exceeded |
6 |
Execution timed out |
3012 ms |
78804 KB |
Time limit exceeded |
7 |
Execution timed out |
3096 ms |
78888 KB |
Time limit exceeded |
8 |
Execution timed out |
3032 ms |
78888 KB |
Time limit exceeded |