Page 6 of 19
Posted: Mon Jan 09, 2006 2:56 pm
by Schutzstaffel
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.
488 - Triangle Wave
Posted: Thu Jun 22, 2006 11:28 am
by TripShock
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;
}
Posted: Thu Jun 22, 2006 5:21 pm
by chunyi81
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.
Posted: Thu Jun 22, 2006 9:59 pm
by TripShock
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' ?
Posted: Sat Jun 24, 2006 11:42 am
by chunyi81
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.
Posted: Sat Jun 24, 2006 6:26 pm
by TripShock
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;
}
Posted: Wed Jan 31, 2007 3:13 pm
by newton
tankyou very much for the example i got AC.
newton ......................... simply the best
Posted: Wed Jan 31, 2007 3:24 pm
by helloneo
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
488 P.E!
Posted: Sat Feb 03, 2007 6:13 am
by linux
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;
}

Posted: Sat Feb 03, 2007 6:18 am
by helloneo
Search first..
Don't open a new thread if there is one already..
Yahoo-o-o-o-o-o-o-o-o! Got AC!
Posted: Sat Feb 03, 2007 6:39 am
by linux
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.
Posted: Sat Feb 03, 2007 7:31 am
by newton
Mr LINUX.
you must delete your code after AC. Otherwise another person may copy and paste it.
best of luck.
newton......................................... simply the best!
AC
Posted: Sat Feb 03, 2007 7:43 am
by linux
[Removed]
Re: Days changed!
Posted: Sat Feb 03, 2007 8:05 am
by helloneo
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..
Posted: Sat Feb 03, 2007 2:29 pm
by newton
thanx.