4 Discussion / Question Topics

Remove Filter
Member Avatar for
Member Avatar for prakhs

Hi, I came across one question from codechef. [Click Here](http://www.codechef.com/problems/J7) Here, we are given P and S. Let l, b, h be the length, breadth, height of the box. we have these two inequalities 4*(l+b+h) <= P 2*(l*b+b*h+h*l) <= S We have to maximise the volume which is l*b*h. We …

Member Avatar for Adak
0
182
Member Avatar for prakhs

#include <stdio.h> #include <ctype.h> #include <string.h> #include <stdlib.h> int compare(const void * a, const void * b) { return strcmp(a, b); } struct node { char name[51]; int index; }; /* 1.Sort the Array cities (which was copy of A) and Array B2 (which was copy of B). 2.Do binary …

Member Avatar for prakhs
0
162
Member Avatar for prakhs

http://www.codechef.com/problems/NUKES I'm getting time limit exceeded in my code... Please some one help me out with this code. My algorithm is when A - ((N+1) ^ (p+1)) < 0 then pth chamber will have 1 particle and the new value of A in my recursive function is A - ((N+1) …

Member Avatar for L7Sqr
0
638
Member Avatar for swissknife007

[CODE] #include <iostream> #include<stdio.h> #include<string.h> using namespace std; int main() { // cout << "Hello world!" << endl; int t,i,j,a,flag; char str[1000001]; cin>>t; while(t--) { a=1; scanf("%s",str); for(i=0;i<=strlen(str);i++) {flag=0; if(!isdigit(str[i])) {flag=0; for(j=i-1;isdigit(str[j]);j--) { if(str[j]!='0') { flag++; a*=str[j]-'0'; //cout<<"flag"<<flag<<" "<<a<<"A"<<endl; break; } } if(flag==0) { a=0;break; } } while(a>9) { if((a%10)!=0) …

Member Avatar for StuXYZ
0
516

The End.