QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#209092#7146. Geometric progressionbkd001WA 0ms3728kbC++14828b2023-10-10 09:49:402023-10-10 09:49:40

Judging History

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

  • [2023-10-10 09:49:40]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3728kb
  • [2023-10-10 09:49:40]
  • 提交

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,1,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;	
}

详细

Test #1:

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

input:

3
1 2 4

output:

1

result:

ok 1 number(s): "1"

Test #2:

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

input:

4
1 2 4 8

output:

2

result:

ok 1 number(s): "2"

Test #3:

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

input:

10
4 5 6 7 8 9 10 12 14 15

output:

0

result:

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