結果
| 問題 | 
                            No.1336 Union on Blackboard
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-01-15 21:53:30 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 541 bytes | 
| コンパイル時間 | 1,922 ms | 
| コンパイル使用メモリ | 172,480 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-26 14:19:06 | 
| 合計ジャッジ時間 | 2,865 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | WA * 31 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
int main(){
    int t,y,z,c,ans;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        queue<int>a;
        rep(i,n){
            int x;
            cin>>x;
            a.push(x);
        }
        rep(i,n-1){
            y=a.front();a.pop();
            z=a.front();a.pop();
            c=y+z+y*z;
            a.push(c);
        }
        ans=a.front();a.pop();
        cout<<ans<<endl;
    }
    return 0;
}