Youth Software Programming (C Language) Level Exam Paper (Level 1)
Score:100 Number of Questions:5
1. Programming Questions(Total5 questions, each worth20 points, totaling100 points)
1.Input and Output of Numbers
Input and Output of Numbers
Input an integer and a double-precision floating-point number, first output the floating-point number rounded to2 decimal places, then output the integer.
Time Limit:1000
Memory Limit:65536
Input
A line with two numbers, an integerN (not exceeding the integer range), and a double-precision floating-point number F, separated by a space.
Output
A line with two numbers, the floating-point number F rounded to2 decimal places, and the integer N, separated by a space.
Sample Input
100 123.456789
Sample Output
123.46 100
Question Number:
Question Type: Programming Question
Standard Answer:
Question Difficulty: Average
Question Analysis:
Display Address: Click to Browse
Candidate’s Answer:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int N;
float F;
cin>>N>>F;
printf(“%.2f”,F);
cout<<” “<<N;
return 0;
}
Candidate’s Score:20
Graded: Yes
Evaluation Description:
2.(a/b)*c Value
(a/b)*c Value
Given integersa, b, c, calculate the value of (a / b)*c, where the division is real number division.
Time Limit:1000
Memory Limit:65536
Input
A line with three integersa, b, c, separated by spaces. (1 ≤ a,b,c ≤ 1000)
Output
Output the result rounded to6 decimal places.
Sample Input
1 3 3
Sample Output
1.000000
Question Number:
Question Type: Programming Question
Standard Answer:
Question Difficulty: Average
Question Analysis:
Display Address: Click to Browse
Candidate’s Answer: (This question has been answered)
Candidate’s Score:0
Graded: Yes
Evaluation Description:
3.Uppercase Letter Check
Uppercase Letter Check
Input a character and check if it is an English uppercase letter, i.e., if it is one ofA-Z.
Time Limit:1000
Memory Limit:65536
Input
A character.
Output
If it is an English uppercase letter, outputYES, otherwise output NO.
Sample Input
K
Sample Output
YES
Question Number:
Question Type: Programming Question
Standard Answer:
Question Difficulty: Average
Question Analysis:
Display Address: Click to Browse
Candidate’s Answer: (This question has been answered)
#include<bits/stdc++.h>
using namespace std;
int main()
{
char a;
cin>>a;
if((int)a>=65&&(int)a<=91)
{
cout<<“YES”;
}
else
{
cout<<“NO”;
}
}
Candidate’s Score:20
Graded: Yes
Evaluation Description:
4.Special Sum
Special Sum
If a number can be divided by7 or contains the digit 7 in its decimal representation, we call this number a phantom number. For example, 17, 21, and 73 are phantom numbers, while 6 and 59 are not.
For a givenN, calculate the sum of all phantom numbers from 1 to N.
Time Limit:1000
Memory Limit:65536
Input
An integerN (1 < N < 10000).
Output
An integer representing the sum of all phantom numbers from 1 to N.
Sample Input
14
Sample Output
21
Question Number:
Question Type: Programming Question
Standard Answer:
Question Difficulty: Average
Question Analysis:
Display Address: Click to Browse
Candidate’s Answer: (This question has been answered)
Candidate’s Score:0
Graded: Yes
Evaluation Description:
5.Coin Flipping
Coin Flipping
Assuming there areN coins (N is a positive integer not exceeding 5000), numbered from 1 to N, initially all facing heads up; there are M people (M is a positive integer not exceeding N) also numbered from 1 to M.
The first person (No. 1) flips all the coins once, the second person (No. 2) flips the coins numbered as multiples of 2 once, the third person (No. 3) flips the coins numbered as multiples of 3 once. Following the increasing order of numbering, subsequent people do the same as No. 3, flipping the coins that are multiples of their own number once.
Question: After the M-th person has operated, which coins are facing heads up? Output their numbers in ascending order, separated by spaces.
Time Limit:10000
Memory Limit:65536
Input
Input positive integersN and M, separated by a single space.
Output
Output the numbers of the coins facing heads up, separated by spaces.
Sample Input
10 10
Sample Output
2 3 5 6 7 8 10
Question Number:
Question Type: Programming Question
Standard Answer:
Question Difficulty: Average
Question Analysis:
Display Address: Click to Browse
Candidate’s Answer: (This question has been answered)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int N,M;
cin>>N>>M;
int n[N]={0};
for(int i=1;i<=M;i++)
{
for(int j=0;j<N;j++)
{
if((j+1)%i==0)
{
if(n[j]==0)
{
n[j]=1;
}
else
{
n[j]=0;
}
}
}
}
for(int i=0;i<N;i++)
{
if(n[i]==0)
{
cout<<i+1<<” “;
}
}
}
Candidate’s Score:20
Graded: Yes
Evaluation Description: