結果

問題 No.104 国道
ユーザー tsuishi
提出日時 2022-08-02 16:17:48
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 604 bytes
コンパイル時間 1,138 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 09:48:51
合計ジャッジ時間 1,018 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'GETWORD':
main.c:6:63: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration]
    6 | static char *GETWORD(char* str) {char c;char *cp;cp=&str[0];c=getchar_unlocked();while( c != EOF ){if((c==' ')||( c=='\n')) break;*cp++=c;c=getchar_unlocked();}*cp='\0';return &str[0];}
      |                                                               ^~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
// Yukicoder №104 国道
// https://yukicoder.me/problems/no/104
// ***********************
static char *GETWORD( char* str );
static char *GETWORD(char* str) {char c;char *cp;cp=&str[0];c=getchar_unlocked();while( c != EOF ){if((c==' ')||( c=='\n')) break;*cp++=c;c=getchar_unlocked();}*cp='\0';return &str[0];}
#define INPBUF (30+2)

// ***********************
// 外部変数
// ***********************
int main() {

	char	str[INPBUF];
	long		rt=1;
	char *p;

	p = str;
	GETWORD(p);
	while(*p !='\0') {
		rt *= 2;
		if(*p == 'R') rt++;
		++p;
	}
	printf("%ld\n",rt);
	return 0;
}
0