結果

問題 No.146 試験監督(1)
ユーザー ohreitetsuohreitetsu
提出日時 2018-06-13 18:45:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 434 bytes
コンパイル時間 510 ms
コンパイル使用メモリ 64,504 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 03:55:33
合計ジャッジ時間 1,655 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
4,380 KB
testcase_01 AC 126 ms
4,376 KB
testcase_02 AC 127 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long LL;
const LL MAX=1e9+7;
int main(int argc, char* argv[])
{
	int N;
	cin>>N;
	LL ans=0;
	int i;
	LL C;
	LL D;
	LL c;
	for (i=0;i<N;i++){
		cin>>C;
		cin>>D;
		if (C==1){
			D%=MAX;
			ans+=D;
		}else{
			c=C/2;
			if (C%2==0){
				c%=MAX;
				D%=MAX;
				ans+=c*D;
			}else{
				c++;
				c%=MAX;
				D%=MAX;
				ans+=c*D;
			}
		}
		ans%=MAX;
	}
	cout<<ans<<endl;
	return 0;
}
0