結果

問題 No.275 中央値を求めよ
ユーザー sasa
提出日時 2025-03-03 17:20:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 268 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 27,648 KB
実行使用メモリ 8,612 KB
最終ジャッジ日時 2025-03-03 17:20:41
合計ジャッジ時間 2,178 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 38
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:26: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int*’ [-Wformat=]
   12 |                 printf("%d ",&p[i]);
      |                         ~^   ~~~~~
      |                          |   |
      |                          int int*
      |                         %n
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d",&num);
      |         ~~~~~^~~~~~~~~~~
main.cpp:11:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                 scanf("%d",&p[i]);
      |                 ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){
	int num = 0;
	scanf("%d",&num);
	printf("配列の要素数%d\n",num);
	
	int val[num];
	int *p = val;
	for(int i = 0;i < num;i++){
		scanf("%d",&p[i]);
		printf("%d ",&p[i]);
	}
	printf("\n");
	if(num % 2 == 0){
		
	}else{
		
	}
}
0