結果
問題 | No.378 名声値を稼ごう |
ユーザー |
![]() |
提出日時 | 2024-10-13 14:31:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 558 bytes |
コンパイル時間 | 1,511 ms |
コンパイル使用メモリ | 166,984 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-13 14:31:07 |
合計ジャッジ時間 | 1,863 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 |
ソースコード
#include<bits/stdc++.h>using namespace std;typedef long long ll;const int N=1e6+2;int a[N],b[N];ll ans;string a_s;int div(string &a_s,int k){int len,r=0;len=a_s.length();for(int i=0;i<len;i++)a[i]=a_s[len-1-i]-'0';for(int i=len-1;i>=0;i--){r=r*10+a[i];b[i]=r/k;r%=k;}while(len>0&&b[len-1]==0)len--;a_s.clear();for(int i=0;i<len;i++)a_s.push_back(b[len-1-i]+'0');return r;}int main(){ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);cin>>a_s;while(a_s.length())ans+=div(a_s,2);cout<<ans;}