Search found 57 matches

by Adil
Sun Jul 06, 2003 7:04 pm
Forum: C
Topic: about using "sscanf" :=)
Replies: 5
Views: 3704

hi. i would use the following code: [c]#include <stdio.h> #include <string.h> void main() { char arr[80]; int i,j,k; strcpy(arr, "1 2 3"); sscanf(arr, "%d %[^\0]", &i, arr); sscanf(arr, "%d %[^\0]", &j, arr); sscanf(arr, "%d %[^\0]", &k, arr); printf("(%d %d %d)\n", i, j, k); } [/c] in your example,...
by Adil
Fri Jul 04, 2003 7:18 pm
Forum: C++
Topic: A very very small problem
Replies: 12
Views: 3790

afaik...

Code: Select all

while( x ) {...} // works while x is non-zero

// the following works because cin returns a stream when something is read
while( cin >> x) { ... }
// however cin returns null when no data can be read, so the loop breaks
by Adil
Tue Jul 01, 2003 10:49 am
Forum: Volume 103 (10300-10399)
Topic: 10345 - Cricket/Football Goes Down
Replies: 12
Views: 4847

you are given the co-ordinates of three points on the circle (from Ivan's post) and you also know the center (0,0). so now equalize the radii you get, and you'll have 2 equations, with 2 unknowns.

good luck.
by Adil
Mon Jun 30, 2003 6:18 pm
Forum: Volume 101 (10100-10199)
Topic: 10181 - 15-Puzzle Problem
Replies: 36
Views: 19763

i used IDA* with adjustments as mentioned by wyvmak.
by Adil
Sat Jun 28, 2003 6:54 pm
Forum: Volume 101 (10100-10199)
Topic: 10181 - 15-Puzzle Problem
Replies: 36
Views: 19763

i'll try to explain. consider the following tree: A ---------|--------- B(1) C(1) ---|--- ----|---- . . D . . | . . . . . E ----|---- C(2) B(2) | . . . in this tree, A, B, C, D, E are different states. C(1) is the first occurance of state C. C(2), B(1) and B(2) have similar meanings. A is the initia...
by Adil
Fri Jun 27, 2003 7:42 pm
Forum: Volume 101 (10100-10199)
Topic: 10181 - 15-Puzzle Problem
Replies: 36
Views: 19763

hi. when i visit a new state, i just checked that a state cannot be an ancestor of itself. i used a stack of depth 52 to keep track of this.

hope this helps.
by Adil
Sat Jun 21, 2003 6:57 pm
Forum: Volume 105 (10500-10599)
Topic: 10512 - A Day in Math-land
Replies: 52
Views: 12896

for input 45 4, X = 4 and Y = 5 is not a valid solution since X >= Y according to the very first line of the problem statement. so the output should be "Impossible." hope this clears the confusion.
by Adil
Fri Jun 20, 2003 5:55 pm
Forum: Java
Topic: Convert data types
Replies: 2
Views: 2080

hi. i haven't tested it, but you might try trimming the "data_string" [ ie, data_string = data_string.trim() ] before you parse to Integer.

good luck, and hope this helps.
by Adil
Wed Jun 18, 2003 3:13 pm
Forum: C++
Topic: Convert Number
Replies: 2
Views: 1814

hi. i would try with the following. void convert(unsigned int val, char *out) { char str[15], *s = str; int len=0; if(!val) { *out++ = '0'; *out = 0; return; } while(val) { if(len%3 == 0 && len) { *s++ = ','; } *s++ = val%10 + '0'; val /= 10; len++; } while(--s >= str) { *out++ = *s; } *out = 0; } i...
by Adil
Tue Jun 03, 2003 6:52 pm
Forum: Volume 100 (10000-10099)
Topic: 10098 - Generating Fast
Replies: 62
Views: 13937

hi. try with this input:

Code: Select all

1
aabcd
hope this helps.
by Adil
Sat May 17, 2003 6:50 pm
Forum: Volume 104 (10400-10499)
Topic: 10468 - Rigid Circle Packing
Replies: 1
Views: 1375

hello. the idea to solve this kind of problems is, i think, to create some equations which will involve both the input and the output. in this particular case, you have to make some equations that would link the box-side-length with the radius of a circle. your job is then to solve them. sometimes y...
by Adil
Fri May 16, 2003 12:18 pm
Forum: C++
Topic: A very very small problem
Replies: 12
Views: 3790

hi. i think you can use:[cpp] while(cin >> i >> j >> k) ...[/cpp]
by Adil
Mon May 12, 2003 8:49 pm
Forum: Volume 101 (10100-10199)
Topic: 10146 - Dictionary
Replies: 8
Views: 4289

hi. here are some input/output. the blank spaces are replaced by '.'

Code: Select all

1

abcde
abcd
abcd
abc
abc
ab
a

abcde
.abcd
..abcd
...abc
...abc
..ab
.a
hope this helps. you can also send my your code.
by Adil
Mon May 12, 2003 8:34 pm
Forum: Volume 104 (10400-10499)
Topic: 10465 - Homer Simpson
Replies: 75
Views: 22710

hello.

the problemstatement asks to maximize the number of burgers, after minimizing the time for drinking beer.
by Adil
Mon May 12, 2003 7:49 pm
Forum: Volume 6 (600-699)
Topic: 652 - Eight
Replies: 22
Views: 8120

hello. my approach with IDA* was following: 1. calculate the minimum moves required (MIN) to reach the goal-state, using the "manhattan" heuristic. 2. starting searching with S as the initial state 3. for a state S let N = number of moves from the starting state to reach S M = number of minimum move...

Go to advanced search