QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#378015 | #8177. Sum is Integer | willy109 | WA | 23ms | 6816kb | C++20 | 1.1kb | 2024-04-05 22:33:08 | 2024-04-05 22:33:09 |
Judging History
answer
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
#define pb push_back
#define F first
#define S second
#define ld long double
#define all(a) a.begin(),a.end()
#define ll long long
#define pii pair <int,int>
#define sz(v) (int)v.size()
#define rep(i , a , b) for(int i=a;i <= (b);i++)
#define per(i , a , b) for(int i=a;i >= (b);i--)
#define deb(x) cout <<#x << " : " << x << "\n" ;
using namespace std ;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int maxn = 2e6 + 10, sq = 1e5 , lg = 19, inf = 1e8+10 , mod = 998244353;
ld p[maxn] ;
signed main(){
ios_base::sync_with_stdio(false);cin.tie(0);
int n ;
cin >> n;
map <ld,int> mp ;
ll ans =0 ;
mp[0]++;
rep(i , 1, n){
int a , b;
cin >> a>> b;
p[i] = p[i-1] + (ld)((ld)a/(ld)b) ;
int z =p[i] ;
ans += mp[(ld)(p[i]-z)] ;
mp[(ld)(p[i]-z)] ++ ;
}
cout << ans << "\n";
return 0;
}
/*
10 7 4
8 4
9 4
7 2
10 2
4 5
3 5
6 7
*/
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3768kb
input:
4 1 6 1 3 1 2 1 2
output:
2
result:
ok "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
5 1 1 2 2 3 3 4 4 5 5
output:
15
result:
ok "15"
Test #3:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
2 1 99999 99999 100000
output:
0
result:
ok "0"
Test #4:
score: -100
Wrong Answer
time: 23ms
memory: 6816kb
input:
200000 82781 82781 86223 86223 16528 16528 84056 84056 94249 94249 54553 54553 25943 25943 10415 10415 52417 52417 46641 46641 70298 70298 84228 84228 55441 55441 49326 49326 11753 11753 89499 89499 58220 58220 71482 71482 32373 32373 7251 7251 78573 78573 74268 74268 46682 46682 20314 20314 85519 8...
output:
6662172467
result:
wrong answer 1st words differ - expected: '10603308211', found: '6662172467'