Submission #9814797
Source Code Expand
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=9000000000000000000;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
if(a<b)return b;
else return a;
}
ll lmin(ll a,ll b){
if(a<b)return a;
else return b;
}
ll gcd(ll a,ll b){
if(a<b)swap(a,b);
if(b==0)return a;
if(a%b==0)return b;
return gcd(b,a%b);
}
ll Pow(ll n,ll k){
ll ret=1;
ll now=n;
while(k>0){
if(k&1)ret*=now;
now*=now;
k/=2;
}
return ret;
}
ll popcount(ll n){
ll ret=0;
while(n>0){
ret+=n%2;
n/=2;
}
return ret;
}
ll gya[1000010];
ll kai[1000010];
ll beki(ll n,ll k,ll md){
ll ret=1;
ll now=n;
while(k>0){
if(k%2==1){
ret*=now;
ret%=md;
}
now*=now;
now%=md;
k/=2;
}
return ret;
}
ll gyaku(ll n,ll md){
return beki(n,md-2,md);
}
int main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll n;cin>>n;
ll s[n];
rep(i,0,n)cin>>s[i];
bool dp[n+1][10001];
memset(dp,0,sizeof dp);
dp[0][0]=true;
rep(i,0,n){
rep(j,0,10001){
if(dp[i][j]==false)continue;
dp[i+1][j]=true;
dp[i+1][j+s[i]]=true;
}
}
rrep(i,10000,0){
if(i%10==0)continue;
if(dp[n][i]){
cout<<i<<endl;
return 0;
}
}
cout<<0<<endl;
}
Submission Info
Submission Time |
|
Task |
C - Bugged |
User |
ttttan |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
2146 Byte |
Status |
AC |
Exec Time |
3 ms |
Memory |
1280 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
Set Name |
Test Cases |
Sample |
a01, a02, a03 |
All |
a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12 |
Case Name |
Status |
Exec Time |
Memory |
a01 |
AC |
1 ms |
256 KB |
a02 |
AC |
1 ms |
256 KB |
a03 |
AC |
1 ms |
256 KB |
b04 |
AC |
1 ms |
256 KB |
b05 |
AC |
2 ms |
1280 KB |
b06 |
AC |
2 ms |
896 KB |
b07 |
AC |
2 ms |
1280 KB |
b08 |
AC |
2 ms |
1280 KB |
b09 |
AC |
2 ms |
1280 KB |
b10 |
AC |
1 ms |
256 KB |
b11 |
AC |
2 ms |
1280 KB |
b12 |
AC |
3 ms |
1280 KB |