結果
問題 |
No.390 最長の数列
|
ユーザー |
|
提出日時 | 2017-02-21 10:01:37 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 572 bytes |
コンパイル時間 | 590 ms |
コンパイル使用メモリ | 59,360 KB |
実行使用メモリ | 8,832 KB |
最終ジャッジ日時 | 2024-12-30 12:23:17 |
合計ジャッジ時間 | 37,846 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 5 WA * 4 TLE * 6 |
ソースコード
#include <iostream> #include <algorithm> #define MAX_N 100000 using namespace std; int main(){ int x[MAX_N] = {0}; int n; cin >> n; for(int d = 0; d < n; d++){ cin >> x[d]; } // sort(x,x+n); int max = x[n-1]; int ans = 1; int count = 1; int tmp = 0; for(int d = 0; d < n; d++){ tmp = 0; for(int e = 1; e < n; e++){ if(2 * x[tmp] > max) break;//次の数列の要素はないのでストップ if(x[e] % x[tmp] == 0){ count++; tmp = e; } } if(count > ans){ ans = count;}//更新 count = 0; } cout << ans << endl; return 0; }