結果
| 問題 |
No.83 最大マッチング
|
| コンテスト | |
| ユーザー |
umashika
|
| 提出日時 | 2016-02-22 04:08:28 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
OLE
|
| 実行時間 | - |
| コード長 | 782 bytes |
| コンパイル時間 | 425 ms |
| コンパイル使用メモリ | 21,376 KB |
| 実行使用メモリ | 6,784 KB |
| 最終ジャッジ日時 | 2024-09-22 12:49:59 |
| 合計ジャッジ時間 | 37,208 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | OLE * 3 |
| other | WA * 4 OLE * 6 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d",&n);
| ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main()
{
int n;
int i,j;
int ans=0;
int q;
scanf("%d",&n);
while(n>1){
if(n==2){ans=1;n=0;} //2 //8
else if(n==3){ans=7;n=0;} //3 //7
else if(n==4){ans=11;n=0;} //2,2に分ける //6
else if(n==5){ans=71;n=0;} //3,2 //5
else if(n==6){ans=111;n=0;} //2,2,2 //3
else if(n==7){ans=711;n=0;} //3,4 //4
else if(n==8){ans=1111;n=0;}//2,2,2,2 //2
else if(n==9){ans=7111;n=0;} //3,2,2,2 //1
else if(n==10){ans=11111;n=0;}
else{
q = n/10;//1111がqこ作れる
n = n%10;
}
}
//答えはans 1111がqこ
if(ans!=0){
printf("%d",ans);
}
for(i=0;i<q;i++){
printf("1111");
}
printf("\n");
return 0;
}
umashika