結果
| 問題 |
No.1231 Make a Multiple of Ten
|
| コンテスト | |
| ユーザー |
mot
|
| 提出日時 | 2020-09-26 02:46:24 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,649 bytes |
| コンパイル時間 | 644 ms |
| コンパイル使用メモリ | 85,280 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 11:21:39 |
| 合計ジャッジ時間 | 2,167 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 1 |
ソースコード
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);
int main() {
int N;
cin>>N;
int tmp;
int a[10];
for(int i=0;i<10;++i) a[i] = 0;
for(int i=0;i<N;++i) {
cin>>tmp;
a[tmp%10]++;
}
int ans = 0;
ans += a[0];
a[0] = 0;
ans += a[1]/10*10;
a[1] %= 10;
ans += a[2]/10*10;
a[2] %= 10;
ans += a[3]/10*10;
a[3] %= 10;
ans += a[4]/10*10;
a[4] %= 10;
ans += a[5]/10*10;
a[5] %= 10;
ans += a[6]/10*10;
a[6] %= 10;
ans += a[7]/10*10;
a[7] %= 10;
ans += a[8]/10*10;
a[8] %= 10;
ans += a[9]/10*10;
a[9] %= 10;
int ans1 = 0;
for(int t1=0;t1<=a[1];++t1) {
for(int t2=0;t2<=a[2];++t2) {
for(int t3=0;t3<=a[3];++t3) {
for(int t4=0;t4<=a[4];++t4) {
for(int t5=0;t5<=a[5];++t5) {
for(int t6=0;t6<=a[6];++t6) {
for(int t7=0;t7<=a[7];++t7) {
for(int t8=0;t8<=a[8];++t8) {
for(int t9=0;t9<=a[9];++t9) {
if((t1+2*t2+3*t3+4*t4+5*t5+6*t6+7*t7+8*t8+9*t9)%10==0) {
ans1 = max(ans1, t1+t2+t3+t4+t5+t6+t7+t8+t9);
}
}
}
}
}
}
}
}
}
}
cout<<ans+ans1<<endl;
}
mot