Search found 30 matches

by vinit_iiita
Fri Aug 24, 2007 2:56 pm
Forum: Volume 5 (500-599)
Topic: 548 - Tree
Replies: 23
Views: 10795

#include<iostream> #include<sstream> #include<vector> using namespace std; #define vi vector<int> #define sz size() #define pb push_back #define imax 100000001; struct node{ int data; struct node* left; struct node* right; }; struct node* rec(vi in,vi p) { if (in.sz==0) return NULL; int t; bool fla...
by vinit_iiita
Mon Apr 02, 2007 1:52 pm
Forum: Volume 7 (700-799)
Topic: 732 - Anagrams by Stack
Replies: 17
Views: 11383

//nth combination of 0 and 1's #include<iostream> #include<string> #include<vector> using namespace std; string s1,s2; vector<char> v; void backtrack(int n,int i) { if(i==2*n) { vector<char> vi,vi1; int j=0; for (int k=0;k<v.size();k++) { // cout<<v[k]; if (v[k]=='i') { vi.push_back(s1[j]); j++; } ...
by vinit_iiita
Thu Jan 18, 2007 9:50 pm
Forum: Volume 3 (300-399)
Topic: 336 - A Node Too Far
Replies: 121
Views: 39107

#include<iostream> #include<vector> #include<cmath> #include<string> #include<algorithm> using namespace std; struct edge{ int x; int y; }; int main() { int n; int q=1; while (cin>>n && n!=0) { vector< edge > v; for (int i=0;i<n;i++) { edge e; cin>>e.x>>e.y; v.push_back(e); } vector<int> vin; for (...
by vinit_iiita
Sat Sep 09, 2006 10:28 am
Forum: Volume 4 (400-499)
Topic: 496 - Simply Subsets
Replies: 48
Views: 9029

definition of set does not prohibit repeatition of elements...
by vinit_iiita
Fri Sep 08, 2006 8:00 am
Forum: Volume 103 (10300-10399)
Topic: 10394 - Twin Primes
Replies: 101
Views: 31793

#include<iostream> #include<cmath> using namespace std; int main() { int l=1,u=20000000,d,j; d=u-l+1; bool *flag=new bool[d]; for (int i=0;i<d;i++) flag[i]=true; for (int i=(l%2!=0);i<d;i+=2) flag[i]=false; for (int i=3;i<=sqrt(u);i+=2) { j=l; while (j%i!=0) j++; for (j=j+i;j<u;j+=i) flag[j-l]=fals...
by vinit_iiita
Thu Aug 24, 2006 2:13 pm
Forum: Volume 4 (400-499)
Topic: 496 - Simply Subsets
Replies: 48
Views: 9029

Code: Select all

for input 
-9 -9
9 -9
your output is...

A and B are disjoint

this should be

A is a proper subset of B
hope it will help you...
by vinit_iiita
Thu Aug 24, 2006 10:12 am
Forum: Volume 108 (10800-10899)
Topic: 10878 - Decode the tape
Replies: 23
Views: 15861

thanks a lot martin...i got ac now...
by vinit_iiita
Thu Aug 24, 2006 12:12 am
Forum: Volume 108 (10800-10899)
Topic: 10878 - Decode the tape
Replies: 23
Views: 15861

i would like to know its elobaration...
by vinit_iiita
Thu Aug 24, 2006 12:09 am
Forum: Volume 108 (10800-10899)
Topic: 10878 - Decode the tape
Replies: 23
Views: 15861

hi plz tell me how can i avoid that. i could not figure out how...
by vinit_iiita
Wed Aug 23, 2006 11:26 pm
Forum: Volume 108 (10800-10899)
Topic: 10878 - Decode the tape
Replies: 23
Views: 15861

Code: Select all

code removed after AC 
plz give the test cases for which it is incorret or point out mistakes...
plz help me out...[/b]
by vinit_iiita
Mon Aug 21, 2006 9:29 pm
Forum: Volume 104 (10400-10499)
Topic: 10450 - World Cup Noise
Replies: 42
Views: 19716

thanx i got ac :D
by vinit_iiita
Mon Aug 21, 2006 10:08 am
Forum: Volume 104 (10400-10499)
Topic: 10450 - World Cup Noise
Replies: 42
Views: 19716

I am getting damn stupid WA ??.. #include <iostream> #include <cmath> using namespace std; int main() { int x,i=1; int n; cin>>n; while (i<=n){ cin >> x; long long int a,b,c; a=1;b=1; for (int j=3;j<=x+2;j++) { int t; t=a; a=a+b; b=t; } cout << "Scenario #" << i++ <<":"<< endl << a << endl << endl; ...
by vinit_iiita
Thu Aug 10, 2006 10:05 pm
Forum: Volume 104 (10400-10499)
Topic: 10487 - Closest Sums
Replies: 89
Views: 29562

hi freinds i got re twice i cannot figure out why plz help me... #include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; int main() { int n; int j=1; while (cin>>n && n!=0) { int a[n]; for (int i=0;i<n;i++) cin>>a[i]; vector<long long int> v; for (int i=0;i<n;i...
by vinit_iiita
Wed Aug 09, 2006 7:44 pm
Forum: Volume 5 (500-599)
Topic: 507 - Jill Rides Again
Replies: 92
Views: 29551

i am getting correct answers for all available test cases still i am getting WA plz help... #include<iostream> #include<string> #include<vector> using namespace std; int main() { int n; cin>>n; for (int i=0;i<n;i++) { int q; cin>>q; int a[q-1]; int b[q-1]; for (int j=0;j<q-1;j++) cin>>a[j]; int sum...
by vinit_iiita
Mon Aug 07, 2006 6:17 pm
Forum: Volume 4 (400-499)
Topic: 444 - Encoder and Decoder
Replies: 155
Views: 20838

#include<iostream> #include<string> #include<vector> #include<cmath> #include<algorithm> using namespace std; int main() { string str; while (getline(cin,str)) { if(!((int)str[0]>47 && (int)str[0]<58)) { // int l=0; for (int i=str.size();i>=0;i--) { int t=(int)str[i]; while (t>0) { cout<<t%10; t=t/...

Go to advanced search