We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- All Contests
- HourRank 3
- GCD Exploration
- Discussions
GCD Exploration
GCD Exploration
Sort by
recency
|
14 Discussions
|
Please Login in order to post a comment
include
include
int main(){ unsigned long long int N,a,b,k,x,y=0,z=0,i; scanf("%lld %lld %lld",&N,&a,&b); while (b!=0) { k=b; b=a%b; a=k; } x=N; while (x!=0) { x=x/10; y++; } for (i=1;i<=a;i++) printf ("%lld",N); }
I don't know why only the first case works even after using the standard gcd function and the euclidean algorithm. Please guide.
Learned new thing :) thnx
I am using java to solve this problem. First test case ran successfully. However, I get 'Terminated due to timeout' error for all other test cases. If anyone has solved this using Java, then please suggest the solution that run faster.