mirror of
https://github.com/m1ngsama/code4sk.git
synced 2025-12-25 02:56:17 +00:00
41 lines
713 B
C++
41 lines
713 B
C++
/*
|
|
7-5 ??????
|
|
?? 10
|
|
?? ??
|
|
?? ????
|
|
?????????/????????????,??????????,????????????????????????????????????6/12??????1/2?????????,??????????????,?11/8??11/8;?????????,?????1/1??????
|
|
|
|
????:
|
|
????????????,??????????/??,?:12/34??34??12???????????(???0,?????????????)?
|
|
|
|
??:
|
|
|
|
??C??,?scanf?????????/,?scanf????????
|
|
??Python??,?a,b=map(int, input().split('/'))?????????????
|
|
????:
|
|
?????????????????,????????,?????/???????????
|
|
5/6??6??5?
|
|
|
|
????:
|
|
66/120
|
|
????:
|
|
11/20
|
|
*/
|
|
|
|
#include<stdio.h>
|
|
int main(){
|
|
int zi,mu,r,zi_save,mu_save;
|
|
scanf("%d/%d",&zi,&mu);
|
|
zi_save=zi;
|
|
mu_save=mu;
|
|
if(zi==mu) printf("1/1");
|
|
else{
|
|
r=zi%mu;
|
|
for(;r!=0;r=zi%mu){
|
|
zi=mu;
|
|
mu=r;
|
|
}
|
|
printf("%d/%d",zi_save/mu,mu_save/mu);
|
|
}
|
|
return 0;
|
|
}
|