1. 程式人生 > >LUOGU P1072

LUOGU P1072

csdn return ble dia main lan printf pre clear

題目:https://www.luogu.org/problemnew/show/P1072#sub

題解:https://www.luogu.org/problemnew/solution/P1072

https://www.luogu.org/problemnew/solution/P1072

https://www.luogu.org/blog/Kesdiael3/solution-p1072

http://blog.csdn.net/nuclearsubmarines/article/details/77603154

初高中生逼死人系列

#include <cstdio>
#include <cmath>
using
namespace std; int gcd(int a,int b){ return b==0?a:gcd(b,a%b); } int main(){ int n,a0,a1,b0,b1,ans,m; scanf("%d",&n); for(int i=0;i<n;i++){ ans=0; scanf("%d%d%d%d",&a0,&a1,&b0,&b1); m=sqrt(b1+1); for (int i=a1;i<=m;i+=a1){
if (gcd(i,a0)==a1&&gcd(i,b0)*b1==b0*i) ans++; } printf("%d\n",ans); } }

一半數據被卡住。

LUOGU P1072