結果
| 問題 | No.146 試験監督(1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-13 18:45:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 132 ms / 1,000 ms |
| コード長 | 434 bytes |
| コンパイル時間 | 540 ms |
| コンパイル使用メモリ | 65,128 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-30 14:09:03 |
| 合計ジャッジ時間 | 1,691 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
ソースコード
#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;
}