QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#209095#7146. Geometric progressionbkd001WA 0ms3676kbC++14828b2023-10-10 09:50:212023-10-10 09:50:21

Judging History

你现在查看的是最新测评结果

  • [2023-10-10 09:50:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3676kb
  • [2023-10-10 09:50:21]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long 
using db = double;
const ll inf = 1e8;
const int N = 1e6+10;
const ll p = 998244353;
const db esp = 1e-8;
#define rep(i,l,r) for(int i = l;i <= r;i++)
#define frep(i,l,r) for(int i = r;i >= l;i--)
ll aa[N];

void solve(bool _k){
	int n;
	cin>>n;
	ll ma = 0;
	rep(i,1,n)cin>>aa[i],ma = max(ma,aa[i]);
	ll ans = 0;
	rep(i,2,ma){
		rep(j,1,n){
			ll a0 = aa[j],a1 = a0*i,a2 = a1*i;
			if(a2 > ma)break;
			ll cnt0 = 0,cnt1 = 0,cnt2 = 0;
			rep(z,j,n){
				if(aa[z] == a0)cnt0++;
				if(aa[z] == a1)cnt1 += cnt0;
				if(aa[z] == a2)cnt2 += cnt1;
			}
			ans += cnt2;
		}
	}
	cout<<ans<<'\n';
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	int TT = 1;
//	cin>>TT;
	rep(i,1,TT)solve(i == TT);
	return 0;	
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3668kb

input:

3
1 2 4

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

4
1 2 4 8

output:

2

result:

ok 1 number(s): "2"

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3600kb

input:

10
4 5 6 7 8 9 10 12 14 15

output:

0

result:

wrong answer 1st numbers differ - expected: '1', found: '0'