All about problems in Volume 4. If there is a thread about your problem, please use it. If not, create one with its number in the subject.
Moderator: Board moderators
Schutzstaffel
New poster
Posts: 37 Joined: Fri Apr 30, 2004 6:52 pm
Location: Portugal
Post
by Schutzstaffel » Mon Jan 09, 2006 2:56 pm
This is weird, the main change you did was to not test when it was the last wave and print the newline anyway (I kept the the multiple inputs) and of course to simplify the code that was really messy lol but the thing is I had outputs that were equals to the now AC code
I thought maybe it would be because I tested if frequency and amplitute were 0 but I also tried without that.
Oh well it's AC now, thanks for your help and for everyone else who replied.
Posted code edited.
TripShock
New poster
Posts: 14 Joined: Tue Jun 20, 2006 9:33 am
Post
by TripShock » Thu Jun 22, 2006 11:28 am
this program seems t conform to all the rules but still gets PE! help!
Code: Select all
#include <iostream>
using namespace std;
int main()
{
short a = 0;
short f = 0;
short n = 0;
cin >> n;
while(n)
{
cin >> a;
cin >> f;
for(char i = 1; i <= f; i++)
{
for(char j = 1; j <= a; j++)
{
for(char k = 1; k <= j; k++)
cout << (int)j;
if(a != 1)
cout << endl;
}
for(char j = a - 1; j >= 1; j--)
{
for(char k = 1; k <= j; k++)
cout << (int)j;
cout << endl;
}
if(!(i == f && n == 1))
cout << endl;
}
n--;
}
return 0;
}
chunyi81
A great helper
Posts: 293 Joined: Sat Jun 21, 2003 4:19 am
Location: Singapore
Post
by chunyi81 » Thu Jun 22, 2006 5:21 pm
Check the output description:
The outputs of two consecutive cases will be separated by a blank line.
NOTE: There is a blank line after each separate waveform, excluding the last one
Remove your code after you get AC.
TripShock
New poster
Posts: 14 Joined: Tue Jun 20, 2006 9:33 am
Post
by TripShock » Thu Jun 22, 2006 9:59 pm
Input:
1
3
2
Output:
1\n
22\n
333\n
22\n
1\n
\n
1\n
22\n
333\n
22\n
1\n
Should I remove the last '\n' ?
chunyi81
A great helper
Posts: 293 Joined: Sat Jun 21, 2003 4:19 am
Location: Singapore
Post
by chunyi81 » Sat Jun 24, 2006 11:42 am
TripShock wrote: Input:
1
3
2
Output:
1\n
22\n
333\n
22\n
1\n
\n
1\n
22\n
333\n
22\n
1\n
Should I remove the last '\n' ?
Nope. In fact this is ok. Apparently I overlooked one line of code in your program which does this. But then again to get AC you have to print a blank line after each triangle wave, which is exactly what my AC program (no PE) did. I know what my AC program did does not really conform to the output description. I will leave a post in the Bugs and Suggestions forum regarding this.
TripShock
New poster
Posts: 14 Joined: Tue Jun 20, 2006 9:33 am
Post
by TripShock » Sat Jun 24, 2006 6:26 pm
I don't get it! Now i'm getting WA!!!
Code: Select all
#include <iostream>
using namespace std;
int main()
{
short a = 0;
short f = 0;
short n = 0;
cin >> n;
while(n)
{
cin >> a;
cin >> f;
for(char i = 1; i <= f; i++)
{
for(char j = 1; j <= a; j++)
{
for(char k = 1; k <= j; k++)
cout << (int)j;
cout << endl;
}
for(char j = a - 1; j >= 1; j--)
{
for(char k = 1; k <= j; k++)
cout << (int)j;
cout << endl;
}
if(!(i == f && n == 1))
cout << endl;
}
n--;
}
return 0;
}
newton
Experienced poster
Posts: 162 Joined: Thu Jul 13, 2006 7:07 am
Location: Campus Area. Dhaka.Bangladesh
Contact:
Post
by newton » Wed Jan 31, 2007 3:13 pm
tankyou very much for the example i got AC.
newton ......................... simply the best
Last edited by
newton on Thu Feb 01, 2007 7:46 am, edited 1 time in total.
helloneo
Guru
Posts: 516 Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea
Post
by helloneo » Wed Jan 31, 2007 3:24 pm
Try this..
My output
Code: Select all
1
22
333
22
1
1
22
333
22
1
1
22
333
22
1
1
22
333
22
1
Last edited by
helloneo on Thu Feb 15, 2007 12:25 pm, edited 2 times in total.
linux
Learning poster
Posts: 56 Joined: Sat Jul 01, 2006 12:21 pm
Location: CA-95054
Contact:
Post
by linux » Sat Feb 03, 2007 6:13 am
How this solution can give P.E I cannot imagine that's about 488, the assumed easiest problem. What's wrong with this? Plz help anyone. Plz check out the output first for my solution.
Hope to hear from you soon.
Code: Select all
#include<stdio.h>
main() {
printf("Code removed after AC.\n");
return 0;
}
Last edited by
linux on Sun Feb 04, 2007 11:25 am, edited 1 time in total.
Solving for fun..
helloneo
Guru
Posts: 516 Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea
Post
by helloneo » Sat Feb 03, 2007 6:18 am
Search first..
Don't open a new thread if there is one already..
linux
Learning poster
Posts: 56 Joined: Sat Jul 01, 2006 12:21 pm
Location: CA-95054
Contact:
Post
by linux » Sat Feb 03, 2007 6:39 am
Thanks everyone! The problem was for multiple cases! I got it and got AC.
I opened this thread because old threads weren't enough to recognise the problem! Good luck.
Solving for fun..
newton
Experienced poster
Posts: 162 Joined: Thu Jul 13, 2006 7:07 am
Location: Campus Area. Dhaka.Bangladesh
Contact:
Post
by newton » Sat Feb 03, 2007 7:31 am
Mr LINUX.
you must delete your code after AC. Otherwise another person may copy and paste it.
best of luck.
newton......................................... simply the best!
linux
Learning poster
Posts: 56 Joined: Sat Jul 01, 2006 12:21 pm
Location: CA-95054
Contact:
Post
by linux » Sat Feb 03, 2007 7:43 am
[Removed]
Last edited by
linux on Thu Sep 11, 2008 9:50 pm, edited 3 times in total.
Solving for fun..
helloneo
Guru
Posts: 516 Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea
Post
by helloneo » Sat Feb 03, 2007 8:05 am
linux wrote: Days have changed Newton! If you don't believe try the code to get AC.
I recommend it's impossible for you. Because
days have changed . Try out...
http://acm.uva.es/problemset/author.html [/b]
No.. what newton mean is your code could be a spolier..
In this forum, we remove our code after getting AC..
And another thing, if there is a thread already, we don't open a new thread.. just using old thread to post..
newton
Experienced poster
Posts: 162 Joined: Thu Jul 13, 2006 7:07 am
Location: Campus Area. Dhaka.Bangladesh
Contact:
Post
by newton » Sat Feb 03, 2007 2:29 pm
thanx.
Last edited by
newton on Sat Jul 07, 2007 3:34 pm, edited 1 time in total.