結果

問題 No.2827 Enter User Name to Play
コンテスト
ユーザー vjudge1
提出日時 2025-04-19 05:09:08
言語 C++17(clang)
(clang++ 22.1.2 + boost 1.90.0)
コンパイル:
clang++ -O2 -lm -std=c++1z -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 0 ms / 2,000 ms
コード長 312 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,231 ms
コンパイル使用メモリ 131,584 KB
実行使用メモリ 9,140 KB
最終ジャッジ日時 2026-07-09 21:36:41
合計ジャッジ時間 3,592 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:10:13: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
   10 |     int arr[n];
      |             ^
main.cpp:10:13: note: read of non-const variable 'n' is not allowed in a constant expression
main.cpp:6:9: note: declared here
    6 |     int n;
      |         ^
1 warning generated.

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string name;
    cin>>name;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(int j=0;j<n;j++)
    {
        int num=arr[j];
        // cout<<num;
        cout<<name[num-1];
    }
}
0