結果
問題 | No.1231 Make a Multiple of Ten |
ユーザー | Fuadul222 |
提出日時 | 2020-09-19 02:17:52 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 104 ms / 2,000 ms |
コード長 | 3,621 bytes |
コンパイル時間 | 2,440 ms |
コンパイル使用メモリ | 213,268 KB |
実行使用メモリ | 18,096 KB |
最終ジャッジ日時 | 2024-06-23 13:54:01 |
合計ジャッジ時間 | 3,754 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,940 KB |
testcase_03 | AC | 2 ms
6,944 KB |
testcase_04 | AC | 49 ms
9,984 KB |
testcase_05 | AC | 44 ms
9,216 KB |
testcase_06 | AC | 19 ms
6,940 KB |
testcase_07 | AC | 52 ms
10,368 KB |
testcase_08 | AC | 21 ms
7,168 KB |
testcase_09 | AC | 12 ms
6,944 KB |
testcase_10 | AC | 46 ms
9,472 KB |
testcase_11 | AC | 53 ms
10,752 KB |
testcase_12 | AC | 99 ms
17,364 KB |
testcase_13 | AC | 104 ms
18,096 KB |
testcase_14 | AC | 1 ms
6,940 KB |
testcase_15 | AC | 103 ms
18,008 KB |
コンパイルメッセージ
main.cpp: In function 'void readline(T&)': main.cpp:6:82: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 6 | template <typename T> inline void readline(T &n) {n = 0; int f = 1; register int ch = getchar(); | ^~ main.cpp: In function 'void readlinel(T&)': main.cpp:12:95: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 12 | template <typename T> inline void readlinel(T &n) {n = 0; long long f = 1; register long long ch = getchar(); | ^~
ソースコード
//Author: Fuadul Hasan(fuadul202@gmail.com) //BSMRSTU,Gopalganj #include<bits/stdc++.h> using namespace std; //int input........ template <typename T> inline void readline(T &n) {n = 0; int f = 1; register int ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';n = n * f;} template <typename T, typename TT> inline void readline(T &n, TT &m) { readline(n); readline(m); } template <typename T, typename TT, typename TTT> inline void readline(T &n, TT &m, TTT &l) { readline(n, m); readline(l);} // long long input........ template <typename T> inline void readlinel(T &n) {n = 0; long long f = 1; register long long ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';n = n * f;} template <typename T, typename TT> inline void readlinel(T &n, TT &m) { readlinel(n); readlinel(m); } template <typename T, typename TT, typename TTT> inline void readlinel(T &n, TT &m, TTT &l) { readlinel(n, m); readlinel(l);} //debug.......... #define error(args...) {vector<string>_v=split(#args,',');err(_v.begin(),args);cout<<endl;} vector<string> split(const string &s, char c) {vector<string>v; stringstream ss(s); string x; while (getline(ss, x, c))v.emplace_back(x); return move(v);} void err(vector<string>::iterator it) {} template<typename T, typename... Args>void err(vector<string>::iterator it, T a, Args...args) { cout << it->substr((*it)[0] == ' ', it->length()) << " = " << a << " "; err(++it, args...);} //............ignore it..................// int dx[8]= {1,0,-1,0,-1,-1,1,1};int dy[8]= {0,1,0,-1,-1,1,-1,1}; int tc = 1; #define F first #define S second #define pb push_back #define mp make_pair #define Pi atan(1)*4 #define ll long long int #define happy cin.tie(0); #define point(x) setprecision(x) #define coding ios::sync_with_stdio(false); #define Test printf("Case %d: ",tc++); #define Unique(c) (c).resize(unique(all(c))-(c).begin()) #define vout(v) for (auto z: v) cout << z << " "; cout << endl; void print(int n){printf("%d\n", n);} void Print(int n){printf("%d ", n);} void print(int n,int m){printf("%d ",n);printf("%d ",m);} void print(int n,int m,int k){printf("%d ",n);printf("%d ",m);printf("%d ",k);} void print(ll n){printf("%I64d\n", n);} void Print(ll n){printf("%I64d ", n);} void print(ll n,ll m){printf("%I64d ",n);printf("%I64d ",m);} void print(ll n,ll m,ll k){printf("%I64d ",n);printf("%I64d ",m);printf("%I64d ",k);} int length(long long x){int l = 0;for(long long i=x;i;i/=10)l++;return l;} int length(string s){return s.size();} const int M = 1e9 + 7; long long pow(long long a,long long n){ll res = 1;while(n){if(n&1) res = ((res%M)*(a%M))%M;a = ((a%M)*(a%M))%M;n>>=1;}return res%M;} #define pr pair<int, int> #define vpr vector<pr> #define vi std::vector<int> #define vll std::vector<ll> #define all(n) n.begin(),n.end() const int Inf = (int)2e9 + 5; const ll Lnf = (ll)2e18 + 5; const int N = 4e5 + 5; const int NN = 1e6 + 5; int solve() { //happy coding int n; cin>>n; vector<int>a(n); for(int i=0;i<n;i++){ cin>>a[i]; a[i]%=10; } std::vector<std::vector<int>> dp(n+1,vector<int>(10,-Inf)); dp[0][0] = 0; for(int i=0;i<n;i++){ dp[i+1] = dp[i]; for(int j=0;j<10;j++){ dp[i+1][(j+a[i])%10] = max(dp[i+1][(j+a[i])%10],dp[i][j]+1); } } cout<<dp[n][0]<<endl; return 0; //error(); } int main(){ int test = 1; //readline(test);//(void)getchar(); while (test--)solve();return 0; }