結果

問題 No.999 てん vs. ほむ
ユーザー tailstails
提出日時 2020-10-22 15:28:21
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 275 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 28,928 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-21 09:18:27
合計ジャッジ時間 1,096 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:6:9: warning: implicit declaration of function 'read' [-Wimplicit-function-declaration]
    6 |         read(0,r=rbuf,sizeof rbuf);
      |         ^~~~
main.c:20:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   20 |         printf("%ld",b*2-a);
      |         ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | char rbuf[2000000];
main.c:20:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   20 |         printf("%ld",b*2-a);
      |         ^~~~~~
main.c:20:9: note: include '<stdio.h>' or provide a declaration of 'printf'

ソースコード

diff #

char rbuf[2000000];
main(){
	int x,y,c;
	long a=0,b=0;
	char*r;
	read(0,r=rbuf,sizeof rbuf);
	while(*r++-48>=0);
	while(*r){
		x=0;
		while(c=*r++-48,c>=0){
			x=x*10+c;
		}
		y=0;
		while(c=*r++-48,c>=0){
			y=y*10+c;
		}
		a+=x-y;
		if(b<a) b=a;
	}
	printf("%ld",b*2-a);
}
0