結果

問題 No.1475 時計の歯車Easy
ユーザー Maeda
提出日時 2025-03-17 15:44:33
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 747 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 26,368 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-17 15:44:35
合計ジャッジ時間 2,180 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 42
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |         scanf("%d",&n);
      |         ^~~~~~~~~~~~~~
main.c:8:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |                 scanf("%d",&partsCountList[i]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:10:25: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                         scanf("%d",&partsList[i][j]);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
void main(void){
	int n = 0;
	scanf("%d",&n);
	int partsCountList[n];
	int partsList[n][1000];
	for(int i = 0; i < n ;i++){
		scanf("%d",&partsCountList[i]);
		for(int j = 0 ; j < partsCountList[i];j++){
			scanf("%d",&partsList[i][j]);
		}
	}
	for(int i = 0 ; i < n; i++){
		for(int j = 0;j < partsCountList[i];j++){
			for(int k = j;k < partsCountList[i];k++ ){
				if(partsList[i][j] < partsList[i][k]){
					int num = partsList[i][j];
					partsList[i][j] = partsList[i][k] ;
					partsList[i][k] = num;
				}
			}
		}
	}
	for(int i = 0 ; i < n;i++){
		for(int j = 0 ; j < partsCountList[i] ; j++){
			printf("%d",partsList[i][j]);
			if(j != partsCountList[i]-1 ){
				printf(" ");
			}else{
				printf("\n");
			}
		}
	}
}
0