/ Randle /

记录详情

Time Exceeded


  
# 状态 耗时 内存占用
#1 Time Exceeded ≥2007ms ≥332.0 KiB
#2 Time Exceeded ≥2007ms ≥364.0 KiB
#3 Time Exceeded ≥2007ms ≥368.0 KiB
#4 Time Exceeded ≥2007ms ≥372.0 KiB
#5 Time Exceeded ≥2007ms ≥368.0 KiB
#6 Time Exceeded ≥2007ms ≥384.0 KiB
#7 Time Exceeded ≥2016ms ≥352.0 KiB
#8 Time Exceeded ≥2007ms ≥356.0 KiB
#9 Time Exceeded ≥2007ms ≥380.0 KiB
#10 Time Exceeded ≥2007ms ≥364.0 KiB

代码

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<set>
#include<ctime>
#include<queue>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#define inf 1000000000
#define ll long long
using namespace std;
int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,ans;
int a0,a1,b0,b1;
int gcd(int a,int b)
{
    return b==0?a:gcd(b,a%b);
}
ll lcm(int a,int b)
{
    return (ll)a*b/gcd(a,b);
}
void cal(int x)
{
    if(gcd(x,a0)==a1)
		if(lcm(x,b0)==b1)ans++;
}
int main()
{
    n=read();
    while(n--)
    {
		ans=0;
		a0=read();a1=read();b0=read();b1=read();
		for(int i=1;i<=sqrt(b1);i++)
			if(b1%i==0)
			{
				cal(i);
				if(i*i!=b1)cal(b1/i);
			}
		printf("%d\n",ans);
    }
    return 0;
}

信息

递交者
类型
递交
题目
改编小学数学题(第一个AC奖励5元)
题目数据
下载
语言
C++
递交时间
2017-10-13 11:21:35
评测时间
2017-10-13 11:27:58
评测机
分数
0
总耗时
≥20083ms
峰值内存
≥384.0 KiB