## 356 - Square Pegs And Round Holes

All about problems in Volume 3. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

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.

neno_uci
Experienced poster
Posts: 104
Joined: Sat Jan 17, 2004 12:26 pm
Location: Cuba
I have the strange feeling that i know you...

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.

kotoko
New poster
Posts: 2
Joined: Tue Apr 01, 2008 11:00 pm

### 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.

Articuno
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.
May be tomorrow is a better day............

vahid sanei
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 :

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

shaon_cse_cu08
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;

while(scanf("%d",&n)!=EOF)
{

if(n>=1&&n<=150)
{
com=0;

{
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 .....

shaon_cse_cu08
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....
I'll keep holding on...Until the walls come tumbling down...And freedom is all around .....

shaon_cse_cu08
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 .....

sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

### Re: 356 WA

Use UVatoolkit to test your own input/output.

Experienced poster
Posts: 136
Joined: Sat Nov 29, 2008 8:01 am
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