356 - Square Pegs And Round Holes
Moderator: Board moderators
- dovier_antonio
- New poster
- Posts: 47
- Joined: Fri Feb 18, 2005 5:00 am
- Location: Havana, Cuba
Thank you!!!!
code removed... thanks!
Last edited by dovier_antonio on Fri Feb 03, 2012 10:13 am, edited 1 time in total.
- dovier_antonio
- New poster
- Posts: 47
- Joined: Fri Feb 18, 2005 5:00 am
- Location: Havana, Cuba
Hi neno_uci
jeje... me too! 

Last edited by dovier_antonio on Fri Feb 03, 2012 10:13 am, edited 1 time in total.
Help with the problem
Hi!
I'm trying to do this problem but have no idea where to start. I want to figure the formulas but honestly don't understand where to start to get there.
I only got as far as you can calculate only for one quarter of the circle because the rest is the same.
Don't get me wrong, I'm not trying to get a free answer it's just that I really haven't got a clue where to start.
Help is much appreciated.
I'm trying to do this problem but have no idea where to start. I want to figure the formulas but honestly don't understand where to start to get there.

I only got as far as you can calculate only for one quarter of the circle because the rest is the same.
Don't get me wrong, I'm not trying to get a free answer it's just that I really haven't got a clue where to start.

Help is much appreciated.
-
- Learning poster
- Posts: 78
- Joined: Sun Nov 30, 2008 5:00 pm
- Location: IUT-OIC, Dhaka, Bangladesh
Re: 356 WA
I thought this is an easy problem but stuck. Can't figure out the way. Can anyone help me with some hints about how to solve this problem?.My geometry is very poor. Please help me.
Thanks in advance.
Thanks in advance.
May be tomorrow is a better day............ 

-
- Learning poster
- Posts: 84
- Joined: Fri Jan 09, 2009 4:37 pm
- Location: IRAN
Re: 356 WA
Why i get Wrong ?
plz Help me
here is my code :
Thanks in advance 
plz Help me
here is my code :
Code: Select all
#include "iostream"
#include "istream"
#include "fstream"
#include "cctype"
#include "cstdlib"
#include "map"
#include "cmath"
#include "vector"
#include "string"
#include "set"
#include "algorithm"
#include "sstream"
#include "ctime"
#include "stack"
#include "queue"
#include "functional"
using namespace std;
#define eps 1e-9
int main(){
//ifstream cin("c.in");
int n;
bool flag=false;
while(cin>>n){
if(flag) cout<<endl;
flag=true;
int t=(2*n-1)/2;
t=(t)*(t+1)*2;
int k=n*n*4;
int x;
if(n<3) x=0;
else{
x=n-2;
x=(x)*(x+1)*2;
}
x=k-(x+t);
printf("In the case n = %d, %d cells contain segments of the circle.\n",n,x);
printf("There are %d cells completely contained in the circle.\n",t);
}
}

Impossible says I`m possible
-
- New poster
- Posts: 50
- Joined: Tue May 25, 2010 9:10 am
- Contact:
356(Square Pegs And Round Holes) WA
I m getting WA..Even Though my output is same to the Sample Output...
#include<stdio.h>
#include<math.h>
int main()
{
int n,com,y,x;
float rad;
while(scanf("%d",&n)!=EOF)
{
if(n>=1&&n<=150)
{
com=0;
rad=(float)(2*n-1)/2;
for(x=1;x<rad;x++)
{
y = (int)sqrt(rad*rad-x*x);
com+=y;
}
printf("In the case n = %d, %ld cells contain ",n,4*(2*n-1));
printf("segments of the circle.\n");
printf("There are %d cells completely ",com*4);
printf("contained in the circle.\n\n");
}
}
return 0;
}
#include<stdio.h>
#include<math.h>
int main()
{
int n,com,y,x;
float rad;
while(scanf("%d",&n)!=EOF)
{
if(n>=1&&n<=150)
{
com=0;
rad=(float)(2*n-1)/2;
for(x=1;x<rad;x++)
{
y = (int)sqrt(rad*rad-x*x);
com+=y;
}
printf("In the case n = %d, %ld cells contain ",n,4*(2*n-1));
printf("segments of the circle.\n");
printf("There are %d cells completely ",com*4);
printf("contained in the circle.\n\n");
}
}
return 0;
}
I'll keep holding on...Until the walls come tumbling down...And freedom is all around ..... 

-
- New poster
- Posts: 50
- Joined: Tue May 25, 2010 9:10 am
- Contact:
There is some Chit Chat i guess....Sry
Removed After AC
The Rain Doesn't Know How 2 Stop....


The Rain Doesn't Know How 2 Stop....
I'll keep holding on...Until the walls come tumbling down...And freedom is all around ..... 

-
- New poster
- Posts: 50
- Joined: Tue May 25, 2010 9:10 am
- Contact:
Plz Check this solution...
Removed After AC



Last edited by shaon_cse_cu08 on Sat Jun 26, 2010 8:34 am, edited 1 time in total.
I'll keep holding on...Until the walls come tumbling down...And freedom is all around ..... 

-
- Experienced poster
- Posts: 136
- Joined: Sat Nov 29, 2008 8:01 am
- Location: narayangong,bangladesh.
- Contact:
Re: 356 WA
The problem statement says
Print a blank line between successive outputs.
But you are printing blank line after each test case.
Life is more complicated than algorithm.
http://felix-halim.net/uva/hunting.php?id=32359
For Hints: http://salimsazzad.wordpress.com
http://felix-halim.net/uva/hunting.php?id=32359
For Hints: http://salimsazzad.wordpress.com
-
- New poster
- Posts: 50
- Joined: Tue May 25, 2010 9:10 am
- Contact:
Re: 356 WA
Tnx...
[The rain Doesn't know Hw 2 stop]
[The rain Doesn't know Hw 2 stop]
I'll keep holding on...Until the walls come tumbling down...And freedom is all around ..... 
