結果
問題 |
No.522 Make Test Cases(テストケースを作る)
|
ユーザー |
![]() |
提出日時 | 2017-06-03 15:13:17 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 142 ms / 2,000 ms |
コード長 | 547 bytes |
コンパイル時間 | 130 ms |
コンパイル使用メモリ | 21,632 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 04:31:20 |
合計ジャッジ時間 | 2,150 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
コンパイルメッセージ
main.c: In function ‘run’: main.c:6:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d",&n); | ^~~~~~~~~~~~~~ main.c: In function ‘run2’: main.c:19:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%d",&n); | ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h> #include<stdlib.h> void run(void){ int n; scanf("%d",&n); int a,b,c; for(a=1;a<=n/3;a++){ for(b=a;b<=(n-a)/2;b++){ c=n-a-b; printf("%d %d %d\n",a,b,c); } } return; } void run2(void){ int n; scanf("%d",&n); int a,b,c; char *s=(char *)malloc(sizeof(char)*5*3*(n+1)); int i=0; for(a=1;a<=n/3;a++){ for(b=a;b<=(n-a)/2;b++){ c=n-a-b; i+=sprintf(s+i,"%d %d %d\n",a,b,c); } printf("%s",s); i=0; } free(s); return; } int main(void){ run2(); return 0; }