#include <iostream>
using namespace std;
int main()
{
int a;
while(cin>>a)
{
if(a%5==0)
{
cout<<"U"<<endl;
}
if(a%5==1)
{
cout<<"G"<<endl;
}
if(a%5==2)
{
cout<<"Y"<<endl;
}
if(a%5==3)
{
cout<<"T"<<endl;
}
if(a%5==4)
{
cout<<"I"<<endl;
}
}
return 0;
}
謝謝 lenonango,williamwang,zisos135,sa4783
#include
using namespace std;
int main()
{
int a;
while(cin>>a)
{
if(a%5==0)
{
cout<<"U"<<endl;
}
if(a%5==1)
{
cout<<"G"<<endl;
}
if(a%5==2)
{
cout<<"Y"<<endl;
}
if(a%5==3)
{
cout<<"T"<<endl;
}
if(a%5==4)
{
cout<<"I"<<endl;
}
}
return 0;
}
用switch更快
謝謝 lenonango,williamwang,zisos135,sa4783