QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#78263#5503. Euclidean AlgorithmCrysflyWA 4994ms3508kbC++111.2kb2023-02-17 15:26:012023-02-17 15:26:03

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-17 15:26:03]
  • 评测
  • 测评结果:WA
  • 用时:4994ms
  • 内存:3508kb
  • [2023-02-17 15:26:01]
  • 提交

answer

// what is matter? never mind. 
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define int long long
using namespace std;
inline int read()
{
	char c=getchar();int x=0;bool f=0;
	for(;!isdigit(c);c=getchar())f^=!(c^45);
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	if(f)x=-x;return x;
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 800005
#define inf 0x3f3f3f3f

int n;

map<int,int>mp;

int calc(int n){
	--n;
	int a,b,k,res=0;
	for(a=1;a*a<=n;++a){
		res+=n/(double)a;
	}
	for(k=n/(double)a;k>=1;a=b+1,--k)
		b=n/(double)k,res+=(b-a+1)*k;
	return res; 
}

int calc1(int n){
	int a,b,k,res=0;
	for(a=1;a*a<=n;++a){
		res+=calc(n/(double)a);
	}
	for(k=n/(double)a;k>=1;a=b+1,--k)
		b=n/(double)k,res+=(b-a+1)*calc(k);
	return res; 
}

void work()
{
//	mp.clear();
	n=read();
	int res=calc1(n);
	cout<<res<<'\n';
}

signed main()
{
	int T=read();
	while(T--)work();
	return 0;
}
/*

10 17
3 10 31

G 4G 7G 10G
G 3G 5G 7G 9G
G 2G 3G 4G 5G


4
A
QUERY B
ADD BBABBBBAAB
QUERY B
*/

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3336kb

input:

3
2
5
14

output:

1
9
62

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 4994ms
memory: 3508kb

input:

3
29107867360
65171672278
41641960535

output:

8921593237562
21300450379746
13136180138427

result:

wrong answer 1st lines differ - expected: '8921593237533', found: '8921593237562'