結果

問題 No.104 国道
コンテスト
ユーザー Himatsubushin
提出日時 2021-07-20 17:13:11
言語 C90
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 227 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 255 ms
コンパイル使用メモリ 37,836 KB
最終ジャッジ日時 2026-02-24 01:07:58
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:9:9: warning: 'gets' is deprecated [-Wdeprecated-declarations]
    9 |         gets(s);
      |         ^~~~
In file included from main.c:1:
/usr/include/stdio.h:667:14: note: declared here
  667 | extern char *gets (char *__s) __wur __attribute_deprecated__;
      |              ^~~~
/usr/bin/ld: /tmp/ccszjvAz.o: in function `main':
main.c:(.text.startup+0xd): 警告: the `gets' function is dangerous and should not be used.

ソースコード

diff #
raw source code

#include <stdio.h>
#include <stdlib.h>

int main() {
	int n = 1, i = 0;
	char s[30];
	s[0] = '\0';

	gets(s);

	while (s[i] != '\0') {
		n *= 2;
		if (s[i] == 'R')
			n++;
		i++;
	}

	printf("%d\n", n);

	return EXIT_SUCCESS;
}
0