結果

問題 No.104 国道
ユーザー tsuishitsuishi
提出日時 2022-08-02 16:17:48
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 604 bytes
コンパイル時間 873 ms
コンパイル使用メモリ 28,532 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 16:03:20
合計ジャッジ時間 1,643 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 0 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 0 ms
4,380 KB
testcase_06 AC 0 ms
4,380 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 0 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 0 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 0 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘GETWORD’ 内:
main.c:6:63: 警告: 関数 ‘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