Code: Select all

```
1. int sum = add every digit of n, since n is at most 2,000,000,000, sum has two digits at most.
2. int temp = sum/10 + sum %10
3. if temp < 10, print temp
else print temp / 10 + temp % 10
```

- Sat Aug 09, 2008 8:29 am
- Forum: Volume 113 (11300-11399)
- Topic: 11332 - Summing Digits
- Replies:
**17** - Views:
**9491**

my algorithm is

this algorithm isn't very fast, but it works

Code: Select all

```
1. int sum = add every digit of n, since n is at most 2,000,000,000, sum has two digits at most.
2. int temp = sum/10 + sum %10
3. if temp < 10, print temp
else print temp / 10 + temp % 10
```

- Sat Aug 09, 2008 8:01 am
- Forum: Volume 114 (11400-11499)
- Topic: 11461 - Square Numbers
- Replies:
**15** - Views:
**6812**

Hey, sirius I solved this problem minutes ago. my algorithm is 1. calculate from 1 to b how many numbers are square numbers. 2. calculate from 1 to a - 1 how my numbers are square numbers. (If a = 1, the obvious answer is 0) 3. step 1 - step 2 , and print the answer to calculate the square numbers, ...

- Sat Aug 09, 2008 7:39 am
- Forum: Volume 100 (10000-10099)
- Topic: 10057 - A mid-summer night's dream.
- Replies:
**21** - Views:
**9877**

Hello, kbr_iut:

I solved this problem this morning. I think your program failed on the following case

your program prints

while my AC program returns
Hope this case will help you debug.

I solved this problem this morning. I think your program failed on the following case

Code: Select all

```
7
1 2 2 3 4 5 7
```

Code: Select all

```
2 3 1
```

Code: Select all

```
3 1 1
```

- Sat Jul 26, 2008 3:43 pm
- Forum: Volume 3 (300-399)
- Topic: 389 - Basically Speaking
- Replies:
**94** - Views:
**22121**

Hey, everybody, my code also gives WA, and I don't know why. Can anybody help? Thanks in advance #include <iostream> #include <cstdlib> #include <string.h> #include <iomanip> #include <math.h> using namespace std; bool k; char answer[100]; int power(int base, int p); int original(char ar[], int a); ...

- Sun Nov 05, 2006 12:07 pm
- Forum: Off topic (General chit-chat)
- Topic: I win !!
- Replies:
**361** - Views:
**122333**

- Sun Nov 05, 2006 12:05 pm
- Forum: Volume 5 (500-599)
- Topic: 544 - Heavy Cargo
- Replies:
**32** - Views:
**14409**

- Sat Nov 04, 2006 5:31 pm
- Forum: Volume 5 (500-599)
- Topic: 534 - Frogger
- Replies:
**41** - Views:
**17552**

- Sat Nov 04, 2006 5:29 pm
- Forum: Volume 5 (500-599)
- Topic: 534 - Frogger
- Replies:
**41** - Views:
**17552**

Can someone please look at my code and tell me what's wrong?? I've got BOUNDLESS WA !! :cry: I think it's just an application of Floyd, so where's my wrong?? any comment is welcome !! Thanks in advance ~~ // Q534 Frogger // select the minimum of longest jumps ~~ minimax #include<iostream> #include<c...

- Mon Oct 16, 2006 3:10 pm
- Forum: Volume 4 (400-499)
- Topic: 476 - Points in Figures: Rectangles
- Replies:
**87** - Views:
**7474**

I don't know why I get so many WA on this easy question. I have read all the thread on Q476, but none of them solved my problem. Can anyone give me a hand ??? Every suggestion is appreciated !!! :D Here's my code: // Q476 Points in figure: Rectangles #include<iostream> #include<cstdlib> #include<alg...

- Tue Aug 29, 2006 8:04 am
- Forum: Volume 101 (10100-10199)
- Topic: 10192 - Vacation
- Replies:
**58** - Views:
**14119**

- Tue Aug 29, 2006 6:13 am
- Forum: Volume 100 (10000-10099)
- Topic: 10090 - Marbles
- Replies:
**43** - Views:
**22073**

- Sun Aug 27, 2006 3:16 pm
- Forum: Volume 2 (200-299)
- Topic: 272 - TEX Quotes
- Replies:
**136** - Views:
**34601**

Thank you very much! it could be accepted. and may i have another question? "Warning: Your program would get a Presentation Error in a true contest. The 24-hours judge interpretes it as an "Accepted" problem. " what did it mean? You get PE for this problem. It means your answer is correct, but your...

- Sun Aug 27, 2006 12:07 pm
- Forum: Volume 5 (500-599)
- Topic: 543 - Goldbach's Conjecture
- Replies:
**109** - Views:
**23498**

I've just solved this problem today !! I do not look throught your code, but my algorithm is like this: (1) use sieve of Eratosthnenes to find all the prime numbers up tp 1000000 (2) add the smallest prime number and the largest prime number which is smaller than n (3) if the sum is equal to n, prin...

- Fri Aug 25, 2006 2:57 pm
- Forum: Volume 2 (200-299)
- Topic: 272 - TEX Quotes
- Replies:
**136** - Views:
**34601**

I do not understand why you write this:
it should be like this:
modify it and you'll get ACC. I have already tried it and the program got ACC immediately !! Good Luck !!

Code: Select all

` char k=1; `

Code: Select all

` int k=1;`

- Fri Aug 18, 2006 1:43 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10192 - Vacation
- Replies:
**58** - Views:
**14119**

I think you can simply solve Q10192 bu using LCS algorithm ~~ There's no trick in this problem. :lol: Check your code one more time ~~ If you still can't find the error, send PM to me and I'll send my ACC code to you !! But I think there isn't much difference between our codes ~~ Hope it will help !...