結果

問題 No.490 yukiソート
ユーザー toto
提出日時 2025-03-25 17:00:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 363 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 28,288 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-25 17:00:37
合計ジャッジ時間 2,072 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 34
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
    5 |         scanf("%d",&val);
      |                ~^  ~~~~
      |                 |  |
      |                 |  long long int*
      |                 int*
      |                %lld
main.cpp:9:25: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
    9 |                 scanf("%d",&num[i]);
      |                        ~^  ~~~~~~~
      |                         |  |
      |                         |  long long int*
      |                         int*
      |                        %lld
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d",&val);
      |         ~~~~~^~~~~~~~~~~
main.cpp:9:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |                 scanf("%d",&num[i]);
      |                 ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	long long val = 0;
	scanf("%d",&val);
	
	long long num[val];
	for(long long i = 0;i < val;i ++){
		scanf("%d",&num[i]);
	}
	
	for(long long i = 0;i < val;i ++){
		for(long long j = 0;j < val;j ++){
			long long tmp = num[i];
			num[i] = num[j];
			num[j] = tmp;
		}
	}
	
	for(int i = 0;i < val;i ++){
		printf("%lld",num[i]);
	}
}
0