Search found 5 matches

by galgamet
Tue May 21, 2002 1:05 pm
Forum: Volume 5 (500-599)
Topic: 587 - There's treasure everywhere!
Replies: 37
Views: 6907

587

The judge told me that this program ran for 0.000 seconds and gave a WA :evil:


#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ctype.h>

int main(void)
{
char map[201];
char dir[3];
int c = 0;
int d;
int i;
float x, y, s;

s = sqrt(0.5);
dir[2] = 0 ...
by galgamet
Tue May 21, 2002 11:17 am
Forum: Volume 6 (600-699)
Topic: 602 - What Day Is It?
Replies: 56
Views: 27995

P.S.

P.S. I changed the while break conditions and valid():

while() breaker now reads:
[c]
if (!day && !month && !year) break;
[/c]

here is valid():
[c]
int valid(int d, int m, int y)
{
if (m>12) return 0;
if (d>DaysInMonthInYear(m, y)) return 0;
if ((d<1) || (m<1) || (y<1)) return 0;

return 1 ...
by galgamet
Tue May 21, 2002 11:09 am
Forum: Volume 6 (600-699)
Topic: 602 - What Day Is It?
Replies: 56
Views: 27995

602 - What Day Is It?

Although my program did all the test inputs correctly, I got a WA. Could someone please print test inputs and their corresponding outputs or check my algorithm and tell me what's wrong with it ?
Thanks in advance

[c]
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int valid(int d, int m ...
by galgamet
Thu May 09, 2002 10:02 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 317910

Ahh...
shame that I didn't notice it :oops:!

"10 1
1 10 20"
by galgamet
Thu May 09, 2002 9:31 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 317910

100

I submitted the following code but got a WA. What may be the problem?
[c]
#include <stdio.h>

int main(void)
{
int cur, c, i, j, cycle, tcyc;

while(scanf("%d %d", &i, &j) == 2) {
if (i > j) { c = i; i = j; j = c; }

tcyc = 0;
for(c=i; c<=j; ++c) {
cycle = 0;
cur = c;
while(1) {
++cycle ...

Go to advanced search