755 - 487--3279
Moderator: Board moderators
-
- New poster
- Posts: 43
- Joined: Fri Jun 25, 2004 9:37 pm
Why on earth are you using a map<char,char> to get the value of each letter? That's insane. Use a switch statement.
Do
map<int,int> phonenumbercount;
When you have the phone number as an INT (which you don't use any C++, ever, to figure out), do phonenumbercount[number]++.
The print your phone number with printf("%03d-%04d",n/10000,n%10000);
The only thing you need from C++ is a single map, indicating how many of each phone number there are, and an iterator to step through them afterwards.
Do
map<int,int> phonenumbercount;
When you have the phone number as an INT (which you don't use any C++, ever, to figure out), do phonenumbercount[number]++.
The print your phone number with printf("%03d-%04d",n/10000,n%10000);
The only thing you need from C++ is a single map, indicating how many of each phone number there are, and an iterator to step through them afterwards.
I think fast for the way , but actually I wrongAndrew Neitsch wrote:Why on earth are you using a map<char,char> to get the value of each letter? That's insane. Use a switch statement.
![:cry:](./images/smilies/icon_cry.gif)
thanks your correction and help , I got AC.....Do
map<int,int> phonenumbercount;
When you have the phone number as an INT (which you don't use any C++, ever, to figure out), do phonenumbercount[number]++.
The print your phone number with printf("%03d-%04d",n/10000,n%10000);
The only thing you need from C++ is a single map, indicating how many of each phone number there are, and an iterator to step through them afterwards.
![:D](./images/smilies/icon_biggrin.gif)
755 WA 487-3279
I've gotten WA for long time.
I tried test input on this board and mine.
please tell me my mistake or some advice.
[cpp]
Accepted nasty my code is cleared.
And Thank you Hiloshi!
[/cpp]
thank you![:D](./images/smilies/icon_biggrin.gif)
![:(](./images/smilies/icon_frown.gif)
I tried test input on this board and mine.
please tell me my mistake or some advice.
[cpp]
Accepted nasty my code is cleared.
And Thank you Hiloshi!
[/cpp]
thank you
![:D](./images/smilies/icon_biggrin.gif)
Last edited by tetuya on Fri Aug 27, 2004 9:29 am, edited 5 times in total.
This is My First Replay
hi tetuya!
I think you had take mistake in func method.
[cpp]
if(counter>0)
printf("%03d-%04d %d\n",tmp/10000,tmp%10000,++counter);
}
skip:;
if(duple) cout << "No duplicates." << endl;
}
[/cpp]
Label skip and follow code is executed any case.
You should type "return" before label skip:
Check this input
1
2
1111111
1111111
--------------
correct output is
111-1111 2
but your program will output
111-1111 2
No duplicates.
I think you had take mistake in func method.
[cpp]
if(counter>0)
printf("%03d-%04d %d\n",tmp/10000,tmp%10000,++counter);
}
skip:;
if(duple) cout << "No duplicates." << endl;
}
[/cpp]
Label skip and follow code is executed any case.
You should type "return" before label skip:
Check this input
1
2
1111111
1111111
--------------
correct output is
111-1111 2
but your program will output
111-1111 2
No duplicates.
Hello emka.
It's a bug.
good luck ![:D](./images/smilies/icon_biggrin.gif)
It's a bug.
![:wink:](./images/smilies/icon_wink.gif)
Code: Select all
else if ( s[i] == 'O' || s[i] == 'N' || s[i] == 'O' || s[i] == '6' )
![:D](./images/smilies/icon_biggrin.gif)
sorry for my poor English.
-
- New poster
- Posts: 12
- Joined: Tue Sep 21, 2004 10:08 pm
755 -> how is this possible??
How is it possible that for the following code,
OJ says it uses only 64 KB when it should use at least 0.3 MB?
It also says WA in 0.00 seconds.
[c]
[/c]
I don't understand this.
OJ says it uses only 64 KB when it should use at least 0.3 MB?
It also says WA in 0.00 seconds.
[c]
[/c]
I don't understand this.
- Ali Arman Tamal
- Learning poster
- Posts: 76
- Joined: Sat Jan 15, 2005 5:04 pm
- Location: Dhaka
- Contact:
755 [487-3279] Why WA ! :-(
Last edited by Ali Arman Tamal on Fri Mar 18, 2005 5:18 pm, edited 1 time in total.
-
- Learning poster
- Posts: 70
- Joined: Sat Feb 05, 2005 9:38 am
- Location: Gurukul
Hi,
You can check this input. Hope it helps. Good luck
Input :-
You can check this input. Hope it helps. Good luck
Input :-
Output:-4
5
-0-0-0-0-1-0-1
IYSDS-1-1-
MMDPS-22
0000A--AA
-----AMSAM--AA
6
3-10-10-1A
6464642
ASACCS5
-1111115
F101010
888-1200
5
-5-5-9-7-4-9-2
2947955
GO-HOME-1
HOME-123
12344-AA
9
-123-5657
12----12121
ABBCSS1
12112-A--B
ABBC-123
-1-2----3AABC
KKSDS-AA
ALNKNDS
----KKJ1234
No duplicates.
No duplicates.
No duplicates.
No duplicates.
Last edited by Raj Ariyan on Tue Mar 08, 2005 2:52 pm, edited 1 time in total.
Some Love Stories Live Forever ....