QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#258712 | #1965. Trio | huzi | WA | 0ms | 3380kb | C++14 | 1.4kb | 2023-11-20 00:33:39 | 2023-11-20 00:33:40 |
Judging History
answer
#include "iostream"
#include "algorithm"
#include "cstdio"
#include "map"
#include "cmath"
using namespace std;
int main(){
int t, p, r = 0, e, mp[10000];
long long ans = 0;
int x[3000], y;
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>t;
for(int i = 0; i < t; i++){
cin>>y;
if(mp[y] == 0){
x[r ++] = y;
mp[y] = 1;
}
else mp[y] += 1;
}
for(int i = 0; i < r; i++) {
if(mp[x[i]] >= 3){
long long d = 1;
for(int u = mp[x[i]]; u >= mp[x[i]] - 2; u --){
d *= u;
}
ans += d / 6;
}
for(int j = i + 1; j < r; j ++){
for(int k = j + 1; k < r; k ++){
int flag = 0;
int n = 10;
for(int z = 1; z <= 4; z ++){
if((x[i] % (int)pow(n, z))/(int)pow(n, z - 1) == (x[j] % (int)pow(n, z))/(int)pow(n, z - 1) && (x[i] % (int)pow(n, z))/(int)pow(n, z - 1) == (x[k] % (int)pow(n, z))/(int)pow(n, z - 1) || (x[i] % (int)pow(n, z))/(int)pow(n, z - 1) != (x[j] % (int)pow(n, z))/(int)pow(n, z - 1) && (x[i] % (int)pow(n, z))/(int)pow(n, z - 1) !=(x[k] % (int)pow(n, z))/(int)pow(n, z - 1)&& (x[j] % (int)pow(n, z))/(int)pow(n, z - 1) != (x[k] % (int)pow(n, z))/(int)pow(n, z - 1))
continue;
else {
flag = 1;
break;
}
}
if(!flag){
ans += mp[x[i]] * mp[x[j]] * mp[x[k]];
}
}
}
}
cout<<ans<<endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3380kb
input:
4 1234 2345 3456 4567
output:
4
result:
ok single line: '4'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3344kb
input:
9 1299 2399 3499 4599 5699 6799 7899 8999 9199
output:
56
result:
wrong answer 1st lines differ - expected: '84', found: '56'