結果

問題 No.2827 Enter User Name to Play
ユーザー vjudge1
提出日時 2025-04-17 18:11:32
言語 C
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 305 bytes
コンパイル時間 2,840 ms
コンパイル使用メモリ 25,472 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-17 18:11:40
合計ジャッジ時間 4,255 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:26: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wformat=]
    7 |                  scanf("%s",&arr[i]);
      |                         ~^  ~~~~~~~
      |                          |  |
      |                          |  int *
      |                          char *
      |                         %ls
main.c:19:27: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wformat=]
   19 |                  printf("%s",&arr3[i]);
      |                          ~^  ~~~~~~~~
      |                           |  |
      |                           |  int *
      |                           char *
      |                          %ls
main.c:4:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |         scanf("%d",&a);
      |         ^~~~~~~~~~~~~~
main.c:7:18: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |                  scanf("%s",&arr[i]);
      |                  ^~~~~~~~~~~~~~~~~~~
main.c:11:18: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                  scanf("%d",&arr2[i]);
      |                  ^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int main(){
	int a;
	scanf("%d",&a);
	int arr[a];
	for(int i=0;i<a;i++){
		 scanf("%s",&arr[i]);
	}
	int arr2[a];
		for(int i=0;i<a;i++){
		 scanf("%d",&arr2[i]);
	}
	int arr3[a];
	for(int i=0;i<a;i++){
		arr3[i]=arr[arr2[i]-1];
	}
	
	for(int i=0;i<a;i++){
		 printf("%s",&arr3[i]);
	}
}
0