Submission #15792907


Source Code Expand

Copy
#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;
}





Submission Info

Submission Time
Task A - Integer Product
User hamayanhamayan
Language C++ (GCC 9.2.1)
Score 300
Code Size 2082 Byte
Status AC
Exec Time 131 ms
Memory 5160 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 10
Set Name Test Cases
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
Case Name Status Exec Time Memory
001.txt AC 9 ms 3616 KB
002.txt AC 2 ms 3512 KB
003.txt AC 18 ms 3620 KB
004.txt AC 90 ms 4716 KB
005.txt AC 131 ms 5160 KB
006.txt AC 116 ms 5140 KB
007.txt AC 119 ms 5096 KB
008.txt AC 97 ms 4968 KB
s1.txt AC 2 ms 3616 KB
s2.txt AC 2 ms 3564 KB