|
|
|
Нужна помощь с переводом
|
|||
|---|---|---|---|
|
#18+
Нужно перевести данный код в Delphi или pascal #include <math.h> #define GRID 0 #define SKEW 1 char *method[] = {"grid", "skew"}; int comp_grid(float a, float b) { return (int)(floor(a) * floor(b)); } int comp_skew(float a, float b) { int x = (int)floor(a); int y = (int)( 1 + floor((b-1)/(sqrt(3)/2))); int x2; if (a-(float)x >= 0.5) x2 = x; else x2 = x-1; if (y%2 == 0) return (y/2) * (x+x2); else return (y/2) * (x+x2) + x; } int main() { float a,b; int max, res, best_method; while (scanf("%f %f",&a,&b) == 2) { max = comp_grid(a,b); best_method = GRID; if ((res = comp_skew(a,b)) > max) { max = res; best_method = SKEW; } if ((res = comp_skew(b,a)) > max) { max = res; best_method = SKEW; } printf("%d %s\n",max,method[best_method]); } return 0; } ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.04.2007, 21:05 |
|
||
|
Нужна помощь с переводом
|
|||
|---|---|---|---|
|
#18+
Или решить эту задачу http://www.magtu.ru/OLIMP/TREN/OnJudge/V1/121.html ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.04.2007, 21:07 |
|
||
|
Нужна помощь с переводом
|
|||
|---|---|---|---|
|
#18+
Вот не люблю халявщиков и делайте что хотите! ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 28.04.2007, 00:55 |
|
||
|
Нужна помощь с переводом
|
|||
|---|---|---|---|
|
#18+
man_555Вот не люблю халявщиков и делайте что хотите! Согласен. Ни спасибо, ни пожалуйста. Надо и все! ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 28.04.2007, 01:39 |
|
||
|
Нужна помощь с переводом
|
|||
|---|---|---|---|
|
#18+
Подсказка - "=" заменяется на ":=" ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 29.04.2007, 17:32 |
|
||
|
|

start [/forum/topic.php?fid=16&msg=34497911&tid=1346090]: |
0ms |
get settings: |
9ms |
get forum list: |
21ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
189ms |
get topic data: |
15ms |
get forum data: |
3ms |
get page messages: |
63ms |
get tp. blocked users: |
2ms |
| others: | 215ms |
| total: | 523ms |

| 0 / 0 |
