#14298: 為何NA


Aaaaaaaaaaaaa (羅傑)

學校 : 臺北市立大同高級中學
編號 : 69102
來源 : [111.235.208.242]
最後登入時間 :
2023-09-13 09:02:41
d693. 最小公倍數 | From: [203.72.178.252] | 發表日期 : 2018-07-12 14:05

#include <iostream>
#include<cmath>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
int a, b, t,d,n;

while( cin >>n )
{
for(int i=0; i<=n; i++){
cin>>a>>b;
if(a==0 || b==0) return 0;
else{

d=a*b;
while( b!=0 )
{
t = b;
b = a%b;
a = t;
}
cout<<d/a<<endl;
}
}
}
return 0;
}

 
#23817: Re:為何NA


kr98k01622354 (弱い)

學校 : 臺北市立建國高級中學
編號 : 103381
來源 : [1.171.232.97]
最後登入時間 :
2023-10-21 00:22:00
d693. 最小公倍數 | From: [111.235.252.96] | 發表日期 : 2020-12-21 17:07

#include
#include
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
int a, b, t,d,n;

while( cin >>n )
{
for(int i=0; i<=n; i++){<------你寫i=0;i<=n;
cin>>a>>b;
if(a==0 || b==0) return 0;
else{

d=a*b;
while( b!=0 )
{
t = b;
b = a%b;
a = t;
}
cout<<d/a<<endl;
}
}
}
return 0;
}



 
ZeroJudge Forum