ProblemA
Description One rainy gloomy evening when all modules hid in the nearbycafes to drink hot energetic cocktails, the Hexadecimal virusdecided to fly over the Mainframe to look for a Great Idea. And shehas found one! Why not make her own Codeforces, with blackjack and other reallycool stuff? Many people will surely be willing to visit thissplendid shrine of high culture. In Mainframe a standard pack of The player has already got the first card, it's the queen ofspades. To evaluate chances for victory, you should determine howmany ways there are to get the second card so that the sum ofpoints exactly equals Input The only line contains Output Print the numbers of ways to get the second card in the requiredway if the first card is the queen of spades. Sample Input
Input
12
Output
4
Input
20
Output
15
Input
10
Output
0 Hint In the first sample only four two's of different suits can earnthe required sum of points. In the second sample we can use all tens, jacks, queens andkings; overall it's In the third sample there is no card, that would add a zero tothe current ten point
代码:
#include<iostream>
#include<stdio.h>
#include<cmath>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
if(n==21){printf("4\n");continue;}
if(n<=10||n>20)
printf("0\n");
if(n>10&&n<20)
printf("4\n");
if(n==20)
printf("15\n");
}
return 0;
}
|
CodeForces 104A
最新推荐文章于 2019-07-04 11:04:00 发布