結果

問題 No.2827 Enter User Name to Play
ユーザー vjudge1
提出日時 2025-04-17 18:13:00
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 292 bytes
コンパイル時間 636 ms
コンパイル使用メモリ 129,408 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-17 18:13:02
合計ジャッジ時間 1,420 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:13:13: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
   13 |     int num[c];
      |             ^
main.cpp:13:13: note: read of non-const variable 'c' is not allowed in a constant expression
main.cpp:5:9: note: declared here
    5 |     int c;
      |         ^
1 warning generated.

ソースコード

diff #

#include<iostream>
using namespace std;
int main(){
    int c;
    cin>>c;
    char *n;
    n=new char [c];

    for(int i=0;i<c;i++ ){
        cin>>n[i];
    }
    int num[c];
    for(int i=0;i<c;i++){
        cin>>num[i];
    }
    for(int i=0;i<c;i++){
        cout<<n[num[i]-1];
    }

}
0