結果

問題 No.104 国道
ユーザー koyopro
提出日時 2015-10-03 11:30:04
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 374 bytes
コンパイル時間 1,122 ms
コンパイル使用メモリ 158,176 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 19:11:17
合計ジャッジ時間 1,792 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%c", &c);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

#define REP(i, n) for(int i=0; i<(n); i++)

signed main()
{
    int ans = 1;
    string s;
    char c;
    while(true) {
        scanf("%c", &c);
        if (c == '\n') break;
        s.push_back(c);
    }
    REP(i,s.size()) {
        ans <<= 1;
        if (s[i] == 'R') ans++;
    }
    cout << ans << endl;

    return 0;
}
0