diff --git a/Codechef/GCDMOD.py b/Codechef/GCDMOD.py new file mode 100644 index 00000000..0911d96c --- /dev/null +++ b/Codechef/GCDMOD.py @@ -0,0 +1,23 @@ +/* + * Shashwat Garg + * B16034 + * IIT Mandi + */ + +def gcd(a,b): + if(b==0): + return a + return gcd(b,a%b) +t=input(); +for i in range(t): + a,b,n=map(int,raw_input().split()) + if(a==b): + res=pow(a,n,1000000007) + res=res+pow(b,n,1000000007) + res=res%(1000000007) + print res + continue + res=pow(a,n,a-b) + res=res+pow(b,n,a-b) + res=res%(a-b) + print gcd(a-b,res) \ No newline at end of file diff --git a/README.md b/README.md index 59a9dd9c..93616c89 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ In this repository, you can find the solutions (as source code) for the problems | [codingCookie](https://github.com/codingCookie)
| Germany | | | | [Keshav Bansal](https://github.com/keshavx11)
| India | | | | [Advaya Andhare](https://github.com/advaya08)
| India | C++ | | +| [Shashwat Garg](https://github.com/Shashwat-Garg)
| India | Python | | ### License