Submission #97314
Source Code Expand
#include <stdio.h> #include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <complex> #include <stack> #include <queue> #include <numeric> #include <stdio.h> #include <string.h> #include <assert.h> using namespace std; static const double EPS = 1e-9; int ROUND(double x) { return (int)(x+0.5); } bool ISINT(double x) { return fabs(ROUND(x)-x)<=EPS; } bool ISEQUAL(double x,double y) { return fabs(x-y)<=EPS*max(1.0,max(fabs(x),fabs(y))); } double SQSUM(double x,double y) { return x*x+y*y; } template<class T> bool INRANGE(T x,T a,T b) { return a<=x&&x<=b; } #define PI (3.14159265358979633846) #define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) #define NG (-1) #define BIG (123456789) #define SZ(a) ((int)((a).size())) #define SQ(a) ((a)*(a)) typedef long long ll; typedef unsigned long long ull; #define FOR(v,i) for(__typeof((v).begin())i=(v).begin();i!=(v).end();++i) // BEGIN CUT HERE #undef FOR #define FOR(v,i) for(auto i=(v).begin();i!=(v).end();++i) // END CUT HERE int main() { int N; cin >> N; static int p[101], sum[101][10001]; for (int i = 0; i < N; i++) { cin >> p[i]; } sum[0][0]=1; for (int i = 0; i < N; i++) { for (int k = 0; k <= 10000; k++) { sum[i+1][k+p[i]] += sum[i][k]; sum[i+1][k] += sum[i][k]; } } int ret = 0; for(int k=0;k<=10000;k++) { if(sum[N][k]) { ret++; } } cout << ret << endl; }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | shindannin |
Language | C++ (G++ 4.6.4) |
Score | 2 |
Code Size | 1670 Byte |
Status | AC |
Exec Time | 27 ms |
Memory | 4628 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 2 / 2 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00, 01, 02, 90, 91 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00 | AC | 20 ms | 1036 KB |
01 | AC | 23 ms | 2584 KB |
02 | AC | 27 ms | 4628 KB |
90 | AC | 20 ms | 828 KB |
91 | AC | 21 ms | 1088 KB |