結果

問題 No.2323 Nafmo、A+Bをする
ユーザー sherringfordsherringford
提出日時 2023-05-28 14:25:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,121 bytes
コンパイル時間 3,671 ms
コンパイル使用メモリ 199,444 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-27 09:44:14
合計ジャッジ時間 4,695 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define all(x) x.begin(),x.end() //vector
#define rep(i,n) for(ll i=0; i<n; ++i)
#define REP(i,n) for(ll i=1; i<=n; ++i)
#define Rep(i,s,n) for(ll i=s; i<n; ++i)
using namespace std;
 
//入力はすべて正とする
//素数判定
bool is_prime (ll n){
    for (ll i=2; i*i<=n; i++){
        if (n%i==0) return false;
    }
    return true;
}

unsigned GetDigit(unsigned num){
	return std::to_string(num).length();
}

string toBinary(int n){
    string r;
    while (n!=0){
        r+=(n%2==0?"0":"1");
        n/=2;
    }
    return r;
}

//vector<vector<int>> a(h, vector<int>(w));
/*
  int n;
  cin >> n;
  int a[n];
  rep(i,n){
    cin >> a[i];
  }
*/
 
int main(){
	ll a,b;
	cin >> a >> b;
	ll ans=a+b;
	ll sum=0;
	ll n=GetDigit(ans);
	rep(i,n){
		if (ans%10!=2){
			sum=sum+pow(10,i)*(ans%10);
			ans/=10;
		}
		else {
			ans/=10;
		}
	}
	ll nn=GetDigit(sum);
	ll anns=0;
	ll i=0;
	while (i<nn){
		anns+=(sum%10)*(pow(2,i));
		sum/=10;
		i++;
	}
	cout << anns << endl;
}
0