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

User avatar
dovier_antonio
New poster
Posts: 47
Joined: Fri Feb 18, 2005 5:00 am
Location: Havana, Cuba

Thank you!!!!

Post by dovier_antonio »

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

Post by neno_uci »

I have the strange feeling that i know you... :D

User avatar
dovier_antonio
New poster
Posts: 47
Joined: Fri Feb 18, 2005 5:00 am
Location: Havana, Cuba

Hi neno_uci

Post by dovier_antonio »

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

Post by kotoko »

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. :o

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. :oops:

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

Post by Articuno »

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

Post by vahid sanei »

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);
	}
}
Thanks in advance :wink:
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

Post by shaon_cse_cu08 »

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

shaon_cse_cu08
New poster
Posts: 50
Joined: Tue May 25, 2010 9:10 am
Contact:

There is some Chit Chat i guess....Sry

Post by shaon_cse_cu08 »

Removed After AC :wink: :wink:

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

shaon_cse_cu08
New poster
Posts: 50
Joined: Tue May 25, 2010 9:10 am
Contact:

Plz Check this solution...

Post by shaon_cse_cu08 »

Removed After AC :wink: :wink:
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 ..... :x

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

Re: 356 WA

Post by sohel »

Use UVatoolkit to test your own input/output.

sazzadcsedu
Experienced poster
Posts: 136
Joined: Sat Nov 29, 2008 8:01 am
Location: narayangong,bangladesh.
Contact:

Re: 356 WA

Post by sazzadcsedu »

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

shaon_cse_cu08
New poster
Posts: 50
Joined: Tue May 25, 2010 9:10 am
Contact:

Re: 356 WA

Post by shaon_cse_cu08 »

Tnx...

[The rain Doesn't know Hw 2 stop]
I'll keep holding on...Until the walls come tumbling down...And freedom is all around ..... :x

Post Reply

Return to “Volume 3 (300-399)”