結果
| 問題 | No.522 Make Test Cases(テストケースを作る) |
| コンテスト | |
| ユーザー |
akakimidori
|
| 提出日時 | 2017-06-03 15:13:17 |
| 言語 | C90(gcc15) (gcc 15.2.0) |
| 結果 |
AC
|
| 実行時間 | 123 ms / 2,000 ms |
| コード長 | 547 bytes |
| 記録 | |
| コンパイル時間 | 178 ms |
| コンパイル使用メモリ | 38,280 KB |
| 最終ジャッジ日時 | 2026-02-24 00:40:24 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#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;
}
akakimidori