Submission #229437


Source Code Expand

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
using namespace std;
#define M_PI 3.141592653589793238
#define EPS 1e-9
#define LINF 1e30  //long long int
#define IINF 1000000000  //int
#define CP complex<long double>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
static const int dx[] = { 1, 0, -1, 0 }, dy[] = { 0, -1, 0, 1 };
long double ccw(long double kari, long double kari1, long double kari2, long double kari3){  //内積
	return kari*kari3 - kari1*kari2;
}
long long int oneday(int year, int month, int day){  //1年1月1日からの、経過日数
	return 365 * year + (year / 4) - (year / 100) + (year / 400) + (306 * (month + 1) / 10) + day - 429;
}
long long int ppow(int a1, int b1){  //a^b
	long long int rr = a1;
	long long int r = 1;
	while (b1>0){
		if (b1 & 1){
			r *= rr;
		}
		rr *= rr;
		b1 >>= 1;
	}
	return r;
}
/*宣言*/
vector<int> k;
int ans = 0;
int n = 0;
int x = 0;
int main(){
	cin >> n >> x;
	for (int i = 0; i < n; i++){
		int kari = 0;
		cin >> kari;
		if ((x >> i) & 1){
			ans += kari;
		}
	}
	cout << ans << endl;
	return 0;
}

Submission Info

Submission Time
Task B - 価格の合計
User Kmcode
Language C++ (G++ 4.6.4)
Score 100
Code Size 1455 Byte
Status AC
Exec Time 24 ms
Memory 924 KB

Compile Error

./Main.cpp:23:0: warning: "M_PI" redefined [enabled by default]
/usr/include/math.h:367:0: note: this is the location of the previous definition

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 20
Set Name Test Cases
Sample subtask0_sample01.txt, subtask0_sample02.txt, subtask0_sample03.txt
All subtask0_sample01.txt, subtask0_sample02.txt, subtask0_sample03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt
Case Name Status Exec Time Memory
subtask0_sample01.txt AC 24 ms 796 KB
subtask0_sample02.txt AC 24 ms 924 KB
subtask0_sample03.txt AC 24 ms 744 KB
subtask1_01.txt AC 24 ms 740 KB
subtask1_02.txt AC 24 ms 796 KB
subtask1_03.txt AC 23 ms 800 KB
subtask1_04.txt AC 24 ms 800 KB
subtask1_05.txt AC 24 ms 800 KB
subtask1_06.txt AC 24 ms 800 KB
subtask1_07.txt AC 23 ms 920 KB
subtask1_08.txt AC 24 ms 800 KB
subtask1_09.txt AC 24 ms 792 KB
subtask1_10.txt AC 23 ms 672 KB
subtask1_11.txt AC 23 ms 800 KB
subtask1_12.txt AC 23 ms 800 KB
subtask1_13.txt AC 24 ms 924 KB
subtask1_14.txt AC 24 ms 676 KB
subtask1_15.txt AC 23 ms 800 KB
subtask1_16.txt AC 24 ms 800 KB
subtask1_17.txt AC 24 ms 800 KB