結果

問題 No.1185 完全な3の倍数
ユーザー Falcon_
提出日時 2020-08-22 17:10:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 466 bytes
コンパイル時間 1,579 ms
コンパイル使用メモリ 167,044 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 11:10:41
合計ジャッジ時間 2,855 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 11 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;cin>>N;
    if(N<100){
        cout<<(N-9)/3<<endl;
        return 0;
    }
    int ans=30;
    string S=to_string(N);
    int count=48;
    for(int i=3;i<S.size();i++){
        ans+=count;
        count*=4;
    }
    if(S.at(0)<3){cout<<ans<<endl; return 0;}
    if(S.at(0)<6){cout<<ans+count/3<<endl; return 0;}
    if(S.at(0)<9){cout<<ans+count/3*2<<endl; return 0;}
    cout<<ans+count<<endl;
}
0