Problem description
The radius of the given circle R, to find the area of the circle.
Input format
The input contains an integer r that represents the radius of the circle.
Output format
The output line, containing a real number, rounded to retain 7 digits after the decimal point, indicating the area of the circle.
description : In the subject, the input is an integer, but the output is a real number.
For the real output of the problem, please be sure to see the real output of the requirements, such as the need to retain the decimal point 7, your program must be strictly output 7 decimal places, output too much or too little number of decimal places are not, will be considered wrong.
The problem with the real output if not specifically stated, rounding is done by rounding.
Sample input
4
Sample output
50.2654825
Data size and conventions
1 <= R <= 10000.
Tips
The accuracy requirement of the subject is higher, please note that the value of π should be more accurate. You can use constants to denote π, such as pi=3.14159265358979323, or you can use mathematical formulas to find π, such as Pi=atan (1.0).
/* Description: In the subject, the input is an integer, but the output is a real number.
For the real output of the problem, please be sure to see the real output of the requirements, such as in the case of the need to retain 7 digits after the decimal point,
Your program must have a strict output of 7 decimal places, the output of too many or too few decimal places is not good, will be considered wrong.
The problem with the real output if not specifically stated, rounding is done by rounding.
*/
ImportJava.text.DecimalFormat;ImportJava.util.Scanner; Public classMain { Public Static Doublepi=pi=3.14159265358979323; Public Static voidMain (string[] args) {Scanner sc=NewScanner (system.in); intR=Sc.nextint (); if(r>=1&&r<=10000) { Doublearea=pi*r*R; DecimalFormat DF=NewDecimalFormat ("0.0000000"); The number of digits after the decimal point System.out.println (Df.format (area));
Can be changed to System.out.printf ("%7f", area); } }}
Problem Descriptionthe value of the 1+2+3+...+n. Input FormatThe input includes an integer n. output Formatoutputs a row, including an integer, that represents the value of the 1+2+3+...+n. Sample Input4Sample OutputTenSample Input -Sample Output5050
Note : There are a few questions that will give you a sample input and output to help you do a better job.
Typically all of these samples require a test pass before committing, but this does not mean that the sample data are correct and your program is completely correct, and potential errors may still result in a lower score.
data size and conventions1 <= n <= 1,000,000,000.
Description: Please note the size of the data here.
The direct idea is to use a loop to accumulate, however, when the data size is large, this "brute force" approach often leads to timeouts. At this point you need to think about other ways. You can try it, if you use 1000000000 as input to your program, your program will not be able to run it within the specified time limit.
Another important point to note is that the size of the answer is not in the range of the default int (int) of your language, and if you use an integer to save the result, the result is wrong.
If you are using C + + or C and are ready to use printf to output the results, your format string should be written as%i64d to output a long long integer.
import Java.util.Scanner; public class Main { public static void main (string[] args) {Scanner sc =new
Scanner (system.in);
long n=sc.nextlong (); if (N>=1&&n<=1000000000 = (n + 1) * N/2; If you do not use the mathematical formula, but directly from 1 to 1000000 to add the loop, run memory will not be enough, also can not measure out System.out.println (sum); } }}
Problem Description
The recursive formula for the Fibonacci sequence is: Fn=fn-1+fn-2, wherein f1=f2=1.
When n is large, FN is also very large, and now we want to know what the remainder of FN divided by 10007 is.
Input FormatThe input contains an integer n. output FormatThe output line contains an integer that represents the remainder of FN divided by 10007.
Note : In the subject, the answer is to require FN divided by 10007 of the remainder, so as long as we can calculate the remainder can be, and do not need to calculate the exact value of FN, and then divide the calculated results by 10007 to take the remainder, the direct calculation of the remainder is often more than the original number of the first and then take more simple.
Sample InputTenSample Output -Sample Input ASample Output7704data size and conventions1 <= n <= 1,000,000.
ImportJava.util.*; Public classMain { Public Static intMAX = 10007; Public Static voidMain (string[] agrs) {Scanner input=NewScanner (system.in); intn =Input.nextint (); intF1 =1, F2 = 1,f3=0; if(n==1| | n==2) System.out.println (1);; Else { for(inti = 3; I <= N; i++) {F3= (F2%max + f1%max)%MAX; F1=F2; F2=f3; } System.out.println (F3); } }}
Blue Bridge Cup-introductory training