diff --git a/Number_Theory/A. Rational Resistance.cpp b/Number_Theory/A. Rational Resistance.cpp new file mode 100644 index 0000000..9f923a8 --- /dev/null +++ b/Number_Theory/A. Rational Resistance.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; +#define int long long +signed main(){ + ios_base::sync_with_stdio(false); + cin.tie(0); + cout.tie(0); + int a, b; + cin>>a>>b; + int ans=0; + while(a&&b){ + if(a>b){ + ans+=a/b; + a%=b; + }else{ + ans+=b/a; + b%=a; + } + } + cout<