Submission #97318


Source Code Expand

Copy
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>
#include<stack>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))

const char dx[]={0,1,0,-1},dy[]={1,0,-1,0};

	int p[100],dp[101][10000]={{0}},ans[10000]={0};
int main(){
	int n;
	dp[0][0]=ans[0]=1;
	scanf("%d",&n);
	rep(i,n)scanf("%d",p+i);
	sort(p,p+n);
	rep(i,n){
		rep(j,10000)if(dp[i][j])dp[#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>
#include<stack>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))

const char dx[]={0,1,0,-1},dy[]={1,0,-1,0};

	int p[100],dp[101][10001]={{0}},ans[10001]={0};
int main(){
	int n;
	dp[0][0]=ans[0]=1;
	scanf("%d",&n);
	rep(i,n)scanf("%d",p+i);
	sort(p,p+n);
	rep(i,n){
		rep(j,10000)if(dp[i][j])dp[i+1][j]=dp[i+1][j+p[i]]=ans[j+p[i]]=1;
	}
	int cnt=0;
	rep(i,10000)cnt+=ans[i];
	printf("%d\n",cnt);
	return 0;
}
i+1][j]=dp[i+1][j+p[i]]=ans[j+p[i]]=1;
	}
	int cnt=0;
	rep(i,10000)cnt+=ans[i];
	printf("%d\n",cnt);
	return 0;
}

Submission Info

Submission Time
Task A - コンテスト
User musasabi
Language C++ (G++ 4.6.4)
Score 0
Code Size 1532 Byte
Status CE

Compile Error

./Main.cpp:32:3: error: stray ‘#’ in program
./Main.cpp: In function ‘int main()’:
./Main.cpp:32:31: error: ‘include’ was not declared in this scope
./Main.cpp:32:39: error: ‘stdio’ was not declared in this scope
./Main.cpp:45:1: error: expected primary-expression before ‘using’
./Main.cpp:45:1: error: expected ‘]’ before ‘using’
./Main.cpp:45:1: error: expected ‘;’ before ‘using’
./Main.cpp:56:11: error: a function-definition is not allowed here before ‘{’ token
./Main.cpp:76:1: error: expected ‘}’ at end of input
./Main.cpp:76:1: error: expected ‘}’ at end of input
./Main.cpp:28:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:29:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]