提出 #15792907
ソースコード 拡げる
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
∧_∧
∧_∧ (´<_` ) Welcome to My Coding Space!
( ´_ゝ`) / ⌒i @hamayanhamayan0
/ \ | |
/ / ̄ ̄ ̄ ̄/ |
__(__ニつ/ _/ .| .|____
\/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/
int N;
int p2[201010], p5[201010];
int cnt[60][30];
//---------------------------------------------------------------------------------------------------
void _main() {
cin >> N;
rep(i, 0, N) {
string s; cin >> s;
ll x = 0;
bool f = false;
int rest = 9;
fore(c, s) {
if (c != '.') {
x = x * 10 + c - '0';
if (f) rest--;
}
else f = true;
}
rep(j, 0, rest) x *= 10;
while (x % 2 == 0) x /= 2, p2[i]++;
while (x % 5 == 0) x /= 5, p5[i]++;
}
rep(i, 0, N) cnt[p2[i]][p5[i]]++;
ll ans = 0;
rep(i, 0, N) {
int need2 = max(18 - p2[i], 0);
int need5 = max(18 - p5[i], 0);
rep(i2, need2, 60) rep(i5, need5, 30) ans += cnt[i2][i5];
if (need2 <= p2[i] && need5 <= p5[i]) ans--;
}
ans /= 2;
cout << ans << endl;
}
提出情報
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
300 / 300 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
s1.txt, s2.txt |
| All |
001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, s1.txt, s2.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 001.txt |
AC |
9 ms |
3616 KiB |
| 002.txt |
AC |
2 ms |
3512 KiB |
| 003.txt |
AC |
18 ms |
3620 KiB |
| 004.txt |
AC |
90 ms |
4716 KiB |
| 005.txt |
AC |
131 ms |
5160 KiB |
| 006.txt |
AC |
116 ms |
5140 KiB |
| 007.txt |
AC |
119 ms |
5096 KiB |
| 008.txt |
AC |
97 ms |
4968 KiB |
| s1.txt |
AC |
2 ms |
3616 KiB |
| s2.txt |
AC |
2 ms |
3564 KiB |