結果
| 問題 | 
                            No.378 名声値を稼ごう
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kongarishisyamo
                         | 
                    
| 提出日時 | 2016-06-22 19:25:52 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 451 bytes | 
| コンパイル時間 | 613 ms | 
| コンパイル使用メモリ | 59,640 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-11 19:23:12 | 
| 合計ジャッジ時間 | 1,276 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 3 WA * 2 | 
ソースコード
#include<iostream>
#include<vector>
using namespace std;
int main(){
	long long N;
	vector<long long> v;
	int notn;
	int maxn;
	cin>>N;
	while(N!=0){
		v.push_back(N);
		N/=2;
	}
	notn=0;
	for(int i=0;i<v.size();i++){
		notn+=v[i];
	}
	maxn=-1;
	for(int i=0;i<v.size();i++){
		int sum=0;
		for(int j=0;j<v.size();j++){
			if(i==j){
				sum+=v[j]*2;
				break;
			}
			else sum+=v[j];
		}
		if(maxn<sum) maxn=sum;
	}
	cout<<maxn-notn<<endl;
}
            
            
            
        
            
kongarishisyamo