11736 - Debugging RAM
Moderator: Board moderators
11736 - Debugging RAM
thank u asu
Last edited by durjay on Mon Jan 11, 2010 7:41 pm, edited 1 time in total.
Re: debugging ram
HI,
its a easy base conversion problem.
look the input carefully ....
4 4
ab 2
Cd 2
ef 3
gh 1
0101
1111
1111
0101
1010
1010
1010
1000
4
Ab
Cd
ef
gh
b=4 is the number of bits in a byte and v =4 is the total number of variables in the RAM where robot is used.
now ab=2, its means it contains 2 bytes in memory(0101,1111);
Cd=2, its means it contains next 2 bytes in memory(1111,0101);
ef=3, its means it contains next 3 bytes in memory(1010,1010,1010);
gh=1,its means it contains next 1bytes in memory(1000);
now i have 4 quary..
Ab->not found in variable.so,ans ab=
Cd->found this variable in the list so, ans is ->11110101->245(Decimal Conversion).
........
MSB is not important , its only make confusion..
i hope now u r understand....
if u get wa you use unsigned long.
"Teme jabo bole to shopno deki ni"
ASU(sust).
its a easy base conversion problem.
look the input carefully ....
4 4
ab 2
Cd 2
ef 3
gh 1
0101
1111
1111
0101
1010
1010
1010
1000
4
Ab
Cd
ef
gh
b=4 is the number of bits in a byte and v =4 is the total number of variables in the RAM where robot is used.
now ab=2, its means it contains 2 bytes in memory(0101,1111);
Cd=2, its means it contains next 2 bytes in memory(1111,0101);
ef=3, its means it contains next 3 bytes in memory(1010,1010,1010);
gh=1,its means it contains next 1bytes in memory(1000);
now i have 4 quary..
Ab->not found in variable.so,ans ab=
Cd->found this variable in the list so, ans is ->11110101->245(Decimal Conversion).
........
MSB is not important , its only make confusion..
i hope now u r understand....
if u get wa you use unsigned long.
"Teme jabo bole to shopno deki ni"
ASU(sust).
-
- Learning poster
- Posts: 64
- Joined: Fri Sep 25, 2009 11:29 am
- Location: Chittagong,University of chittagong
- Contact:
Re: debugging ram
Code Removed
After accepted.
Critical Input:
8 1
ab 8
11111111
11111111
11111111
11111111
11111111
11111111
11111111
11111111
4
ab
ab
cd
ef
Output:
ab=18446744073709551615
ab=18446744073709551615
cd=
ef=
After accepted.
Critical Input:
8 1
ab 8
11111111
11111111
11111111
11111111
11111111
11111111
11111111
11111111
4
ab
ab
cd
ef
Output:
ab=18446744073709551615
ab=18446744073709551615
cd=
ef=
Try to catch fish rather than asking for some fishes.
Re: debugging ram
can anyone plz help me ?? i'm getting wrong ans

Code: Select all
#pragma warning ( disable : 4786 )
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
#include<map>
#include<vector>
#include<string>
using namespace std;
#define _pf printf
#define _sc scanf
int main(){
char array[40],temp[20];
gets(array);
int a,b,i,j;
int k;
vector<string> A;
vector<int> B;
map<string,string> M;
map<string,string>::iterator it;
sscanf(array,"%d %d",&a,&b);
for(i = 0; i<b; i++){
gets(array);
sscanf(array,"%s %d",temp,&k);
A.push_back(temp);
B.push_back(k);
}
for(j = 0; j<B.size(); j++){
int d = B[j];
string S;
for(i = 0; i<d; i++){
gets(temp);
S += temp;
}
M[A[j]] = S;
}
gets(temp);
a = atoi(temp);
for(j = 0; j<a; j++){
gets(temp);
it = M.find(temp);
if(it!=M.end()){
string S = (*it).second;
unsigned long long decimal = 0,bit;
for(i = 0; i<S.size(); i++){
bit = S.at(i) - '0';
decimal = (decimal<<1) + bit;
}
printf("%s=%llu\n",temp,decimal);
}
else printf("%s=\n",temp);
}
return 0;
}
Re: debugging ram
@Tanmoy:
I am afraid you have forgotten that there are multiple test cases(At least your code agrees with me). Make sure that you are taking all the inputs
Hope it helps. . .
I am afraid you have forgotten that there are multiple test cases(At least your code agrees with me). Make sure that you are taking all the inputs

Hope it helps. . .
Re: debugging ram
heeeeeeeyyyyyy taman thanks man i really forgot that.thanks a lot 
