結果
| 問題 |
No.1097 Remainder Operation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-27 02:46:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 356 ms / 2,000 ms |
| コード長 | 457 bytes |
| コンパイル時間 | 1,401 ms |
| コンパイル使用メモリ | 166,964 KB |
| 実行使用メモリ | 34,816 KB |
| 最終ジャッジ日時 | 2024-07-22 18:42:56 |
| 合計ジャッジ時間 | 7,010 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
long dp[40][100000],k,ans;
int main(){
int n,t,i;
cin>>n;
for(int i=0;i<n;i++)cin>>dp[0][i];
for(int i=1;i<40;i++){
for(int j=0;j<n;j++){
dp[i][j]=dp[i-1][j]+dp[i-1][(dp[i-1][j]+j)%n];
}
}
cin>>t;
while(t--){
cin>>k;
ans=0;
for(int i=0;i<40;i++){
if(k>>i&1)ans+=dp[i][ans%n];
}
cout<<ans<<endl;
}
}