結果

問題 No.752 mod数列
ユーザー %20%20
提出日時 2018-03-09 01:16:10
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 400 bytes
コンパイル時間 2,217 ms
コンパイル使用メモリ 193,992 KB
実行使用メモリ 14,008 KB
最終ジャッジ日時 2024-04-15 12:23:41
合計ジャッジ時間 8,222 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
10,508 KB
testcase_01 AC 13 ms
10,564 KB
testcase_02 AC 8 ms
7,348 KB
testcase_03 AC 4 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 14 ms
11,668 KB
testcase_06 AC 8 ms
7,320 KB
testcase_07 AC 14 ms
12,448 KB
testcase_08 AC 14 ms
11,264 KB
testcase_09 AC 12 ms
9,344 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll s[50000000];

main(){
	ll P;
	scanf("%lld",&P);
	for(int i=1;i<=P;++i){
		s[i]=s[i-1]+P%i;
	}
	int Q;
	scanf("%d",&Q);
	for(int i=0;i<Q;++i){
		int L,R;
		scanf("%d%d",&L,&R);
		if(R<=P){
			printf("%lld\n",s[R]-s[L-1]);
		}else if(L<=P){
			printf("%lld\n",s[P]-s[L-1]+P*(R-P));
		}else{
			printf("%lld\n",P*(R-L+1));
		}
	}
}
0