ACM 比赛 运算超时DescriptionLong long ago,there is a great king.To defend his country,he built many castles numbered from 1 to N.In the i-th castle which is co-prime with N,he apportion a general,if hostile country want to kill the general,he w
来源:学生作业帮助网 编辑:六六作业网 时间:2025/02/03 09:41:33
ACM 比赛 运算超时DescriptionLong long ago,there is a great king.To defend his country,he built many castles numbered from 1 to N.In the i-th castle which is co-prime with N,he apportion a general,if hostile country want to kill the general,he w
ACM 比赛 运算超时
Description
Long long ago,there is a great king.To defend his country,he built many castles numbered from 1 to N.In the i-th castle which is co-prime with N,he apportion a general,if hostile country want to kill the general,he will lose one unit.He wants you to help him count number of unit he need.
Two numbers are co-prime if their great common divisor is 1.
Input
The first line contains a single integer T (2
ACM 比赛 运算超时DescriptionLong long ago,there is a great king.To defend his country,he built many castles numbered from 1 to N.In the i-th castle which is co-prime with N,he apportion a general,if hostile country want to kill the general,he w
#include
#include
int p[100001], phi[100001];
int main() {
memset(p,0,sizeof(p));
for (int i=2;i