結果
| 問題 | No.297 カードの数式 |
| コンテスト | |
| ユーザー |
testestest
|
| 提出日時 | 2015-11-06 22:54:21 |
| 言語 | C90 (gcc 12.4.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 624 bytes |
| 記録 | |
| コンパイル時間 | 200 ms |
| コンパイル使用メモリ | 32,896 KB |
| 最終ジャッジ日時 | 2026-02-23 19:44:11 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 1 -- * 2 |
| other | -- * 23 |
コンパイルメッセージ
main.c:1:8: warning: data definition has no type or storage class
1 | long s;a[12],b[12],n,i,c,t;
| ^
main.c: In function ‘main’:
main.c:3:1: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
3 | scanf("%d",&n);
| ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
+++ |+#include <stdio.h>
1 | long s;a[12],b[12],n,i,c,t;
main.c:11:1: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
11 | printf("%d ",s);
| ^~~~~~
main.c:11:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:11:10: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
11 | printf("%d ",s);
| ~^ ~
| | |
| int long int
| %ld
main.c:19:10: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
19 | printf("%d",-s);
| ~^ ~~
| | |
| | long int
| int
| %ld
main.c:26:10: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
26 | printf("%d",s);
| ~^ ~
| | |
| | long int
| int
| %ld
ソースコード
long s;a[12],b[12],n,i,c,t;
main(){
scanf("%d",&n);
for(getchar();i++<n;c<0?c==-5?a[10]++:a[11]++:a[c]++)c=getchar(getchar())-48;
c=n-1-a[10]-a[11];
for(i=0;i<12;i++)b[i]=a[i];
for(t=9;c;)a[t]--?c--,s=s*10+a[t]:t--;
s*=10;
for(t=9;a[10];)a[t]--?a[10]--,s=s+a[t]:t--;
for(t=9;a[11];)a[t]--?a[11]--,s=s-a[t]:t--;
printf("%d ",s);
s=0;
if(b[11]){
for(t=9;c;)b[t]--?c--,s=s*10+b[t]:t--;
s*=10;
for(t=9;b[11];)b[t]--?b[11]--,s=s+b[t]:t--;
for(t=9;b[10];)b[t]--?b[10]--,s=s-b[t]:t--;
printf("%d",-s);
}
else
{
for(t=0;c;)b[t]--?c--,s=s*10+b[t]:t++;
s*=10;
for(t=9;b[10];)b[t]--?b[10]--,s=s+b[t]:t--;
printf("%d",s);
}
return 0;
}
testestest