#14298: 為何NA


Aaaaaaaaaaaaa (羅傑)

學校 : 臺北市立大同高級中學
編號 : 69102
來源 : [111.235.208.242]
最後登入時間 :
2023-09-13 09:02:41

#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.161.43.230]
最後登入時間 :
2025-10-04 14:04:52

#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;
}