Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Peer
  • COMPETE
    • September Algorithm Challenge
    • August Cook-Off 02
    • August Algorithm Challenge
    • July Cook-Off 01
    • January Algorithm Challenge
  • DISCUSS
    • Wiki
    • Forums
    • Blog
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Ranks
    • Tutorials
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • About Directi
Home » Compete » Codechef Campus Snackdown » Rational Numbers

Rational Numbers

Problem code: SNCK04

  • All Submissions

All submissions for this problem are available.

A positive rational number is a real number which can be expressed as P/Q where P, Q are coprime positive intergers. The Chef is very hungry and can get food only if he solves the following question. "Given a number N, find the number of positive rational numbers less than 1 such that when expressed as P/Q, both P, Q are less than or equal to N". Please help the Chef in answering this question. The Chef promises to share the food with you.


Input

The first line contain a single integer T, the number of test cases. Following T (<= 1000) lines will contain a test case, a single number N (<= 1000000).


Output

For each test case print the output on a single line.


Example

Input:
3
1
2
3

Output:
0
1
3

Date: 2009-11-16
Time limit: 3s
Source limit: 50000
Languages: C C99 strict C++ 4.0.0-8 C++ 4.3.2 PAS gpc PAS fpc JAVA NICE JAR C# C#2 NEM ST ASM D FORT ADA BASH PERL PYTH RUBY LUA ICON PIKE PHP SCM guile SCM qobi LISP sbcl LISP clisp SCALA HASK ERL CAML CLPS PRLG WSPC BF ICK JS


  • Submit

Comments

  • Login or Register to post a comment.

why i cannot submit?

Mushroom - 21st Nov,2009 19:36:57.

why i cannot submit?

are we allowed to use

CarPenTers - 21st Nov,2009 19:38:34.

are we allowed to use threading to speed up our programs

How to submit ?  

sivaraman - 21st Nov,2009 19:46:26.

How to submit ?

 

i am getting error restricted

ANAND MOHAN - 21st Nov,2009 19:48:33.

i am getting error restricted content while submitting..help|????

You should log in from your

Admin - 21st Nov,2009 19:51:09.

You should log in from your team accounts in order to submit a problem.

You are not allowed to use

Admin - 21st Nov,2009 19:51:40.

You are not allowed to use threads.

"restricted content" ?? how

rmstar - 21st Nov,2009 20:02:01.

"restricted content" ?? how to submit ??

hey i forgot my team

ANAND MOHAN - 21st Nov,2009 20:08:22.

hey i forgot my team name...what to do??

We are logged in our team

chandra-villa - 21st Nov,2009 20:13:20.

We are logged in our team account.. But still "restricted content" coming..

why i cannot submit the

Balaji - 21st Nov,2009 20:14:42.

why i cannot submit the solutions...?

We are logged in our team

Balaji - 21st Nov,2009 20:15:25.

We are logged in our team account.. But still "restricted content" coming..

You need to log in from your

Admin - 21st Nov,2009 20:16:05.

You need to log in from your team accounts in order to submit a solution.

How to login 4m team's

Sumit Bindal - 21st Nov,2009 20:17:33.

How to login 4m team's account
it is not accepting team name and password
Team name Bytecoders

@Sumit You have to log in

Admin - 21st Nov,2009 20:22:07.

@Sumit

You have to log in from your team name and password. The only reason it may not accept is if you are entering one of them incorrectly.

i have been trying for around

Gautam verma - 21st Nov,2009 20:27:36.

i have been trying for around 1 hr and not able to login.

My team name is coder can admin help me out?

can you mail me my password? please help me out?

hey. are the input numbers

KGP-Rockers - 21st Nov,2009 20:31:05.

hey. are the input numbers sorted????

@KGP-rockers Each test case

Admin - 21st Nov,2009 20:33:42.

@KGP-rockers

Each test case contains only a single number N. The test cases may not be in sorted order.

 

We are logged in from our

chandra-villa - 21st Nov,2009 20:36:23.

We are logged in from our team account which is 'cv' but still we are no able to submit. A message "Restricted Content" is coming each time we click Submit.

hey. are the input numbers

KGP-Rockers - 21st Nov,2009 20:38:05.

hey. are the input numbers sorted????

@ chandra villa You have not

Admin - 21st Nov,2009 20:42:58.

@ chandra villa

You have not registered for Snackdown. Your team is registered for the test contest. You need to register separately for this.

@aniruddha any chance for us

chandra-villa - 21st Nov,2009 20:46:25.

@aniruddha any chance for us competing now??

we were not aware that we had to register separately for today's event

plzzzzzz

@ chandra villa You cannot

Admin - 21st Nov,2009 20:50:36.

@ chandra villa

You cannot participate in today's contest. There are going to be other team contest in the future, you can participate then.

"restricted content" ??

Gladiator - 21st Nov,2009 21:11:06.

"restricted content" ?? unable to submit.

How to submit ??

"restricted content" ??

Gladiator - 21st Nov,2009 21:11:10.

"restricted content" ?? unable to submit.

How to submit ??

Busted again

BUSTED - 21st Nov,2009 21:17:53.

Busted again muddafuckas!

 

What the fuck man! Im tellin you, lemme handle this shit, the world will be much happier.

Fuckin assholes got the braniest motherfuckers up their mama's pussy butr still cant lick their own assholes.

 

how to submit the sol..  

chhaya - 21st Nov,2009 21:20:39.

how to submit the sol..

 

Fuck the mothers of those

Gladiator - 21st Nov,2009 21:29:15.

Fuck the mothers of those chefs who found out such an unorganised layout for such a contest which seems to be great but is rather fucking.

@chayya you have to log in

Admin - 21st Nov,2009 21:30:11.

@chayya you have to log in from your team id

what is the lower bound for

coder - 21st Nov,2009 22:10:22.

what is the lower bound for N?

i am also not able to submit

Nalin - 21st Nov,2009 22:11:55.

i am also not able to submit the content "RESTRICTRD CONTENT" aDMINS PLEASE HELP...i am logged in from my team account

@ Nalin You were supposed to

Admin - 21st Nov,2009 22:15:19.

@ Nalin

You were supposed to register separately for snackdown. You probably registered for the test contest.

@Aniruddha my code is as

TheCoderzz - 21st Nov,2009 22:17:58.

@Aniruddha my code is as clean as it gets but its in Java which makes it slower.... cnt u allow for a slightly longer running time if we code in Java ?

@Aniruddha.. i forgot my team

Kartik Aneja - 21st Nov,2009 22:20:45.

@Aniruddha.. i forgot my team password (team name is TAANSTAFL or T.A.A.N.S.T.A.F.L.).. can you please confirm if we are registered for snackdown or not?

@ Kartik If you are not able

Admin - 21st Nov,2009 22:24:08.

@ Kartik

If you are not able to log in then you are not registered for the contest.

@Aniruddha.....what do u

Nalin - 21st Nov,2009 22:24:51.

@Aniruddha.....what do u mean......i registered through the link in my mail....

wasnt the link for SNACKDOWN..........????

@ Nalin If you registered

Admin - 21st Nov,2009 22:28:32.

@ Nalin

If you registered through that link then you should be able to log in using your team name and password. Since this is a team contest and more than one user uses the same team account we dont allow changing the team password.

@Aniruddha.....what do u

Nalin - 21st Nov,2009 22:29:10.

@Aniruddha.....what do u mean......i registered through the link in my mail....

wasnt the link for SNACKDOWN..........????

@Aniruddha.. honestly.. i

Kartik Aneja - 21st Nov,2009 22:29:24.

@Aniruddha.. honestly.. i forgot my team name.. is there any way of finding out my team the team name i am registered under. My team members include "Nitant" and "alphaq"

so can u pls tell me my team

Nalin - 21st Nov,2009 22:30:32.

so can u pls tell me my team name.......i have forgotten....if it is "nnnn" or "nnnn1".........!!!

pls mail my team name at my

Nalin - 21st Nov,2009 22:32:48.

pls mail my team name at my email........

and if it is "nnnn" then I am

Nalin - 21st Nov,2009 22:33:44.

and if it is "nnnn" then I am logged in with my team name already.......

for input number of 1000000,

Arit Kumar Mondal - 21st Nov,2009 22:38:10.

for input number of 1000000, we are getting high runtime...so what can be the maximum possible number allowed in the input?in the testcase will there be any number as large as 1000000?

HEY ADMIN....... my code is

nnnn - 21st Nov,2009 22:39:59.

HEY ADMIN.......

my code is in JAVA and is showing following error.....

spoj: The program compiled successfully, but Main.class was not found. Class Main should contain method: public static void main (String[] args).

 

but i have a main method....am i supposed to submit my code using "Netbeans"...

pls help.......

@ Nalin You had to register

Admin - 21st Nov,2009 22:40:57.

@ Nalin

You had to register separately for snackdown. If you are already logged in with some team name you need to make sure that it is the same as the one registered for snackdown. If you are not able to submit a solution then you are not logged in with the team name you registered for this contest. We dont allow retrieving user names and passwords.

@ Arit There can be an input

Admin - 21st Nov,2009 22:44:44.

@ Arit

There can be an input with n = 1000000. But not more than that.

HEY ADMIN....... my code is

nnnn - 21st Nov,2009 22:53:47.

HEY ADMIN.......

my code is in JAVA and is showing following error.....

spoj: The program compiled successfully, but Main.class was not found. Class Main should contain method: public static void main (String[] args).

 

but i have a main method....am i supposed to submit my code using "Netbeans"...else my program is running correctly....

pls help.......

@Aniruddha.. is there no way

Kartik Aneja - 21st Nov,2009 22:53:53.

@Aniruddha.. is there no way of finding out my team name.. i've already solved two questions.. please email me at my account's email address if privacy is an issue.

Hey can anybody tell me the

Byters - 21st Nov,2009 22:57:31.

Hey can anybody tell me the trick how to get the code working for n=1000000, it is taking too long.
My code is working fine for smaller inputs

plz help me out.....anybody

yaar time complexity ki

TROJAN_HORSE - 21st Nov,2009 23:05:52.

yaar time complexity ki problem aa rahi hai kuch to help karo :(

my program when submitted

xploiter - 21st Nov,2009 23:19:19.

my program when submitted shows running only for more than 2 minutes

WTH? Couldnt Submit. Same

Desai Rishit Jawahar - 22nd Nov,2009 00:08:35.

WTH?

Couldnt Submit. Same Restricted Content Crap.

Worked my brain off on this one. Solved it and Couldn't submit in the end.

Not happy with the event.

ReEvent.

 

where is the link for

bitsgrox - 22nd Nov,2009 16:32:55.

where is the link for submission??

I m unale to find the link

Sangharsh - 22nd Nov,2009 19:01:03.

I m unale to find the link for sublmission of soutions

HOW come tnu2 bcome eligible

AKSHAY - 23rd Nov,2009 13:48:29.

HOW come tnu2 bcome eligible for MUMBAI finals..   isn't the contest for students of indian universities..  eh?

when will these problems be

Rajat Kansal - 24th Nov,2009 18:50:56.

when will these problems be shifted to practice section ?

The problems are now in the

Admin - 24th Nov,2009 19:47:34.

The problems are now in the practice section.

Directi Go for Gold

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Fetching successful submissions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • feedback@codechef.com
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
Sponsors
The time now is: