当前位置:网站首页>L1-072 scratch lottery
L1-072 scratch lottery
2022-07-04 16:31:00 【HBUcs2020】
This problem is not difficult , But the procedure is a little cumbersome
Be careful :flag[a[i][j]]=1; // a key !! Be careful
Or change to :int b[25] = {0, 0, 0, 0, 0, 0, 10000, 36, 720, 360, 80, 252, 108, 72, 54, 180, 72, 180, 119, 36, 306, 1080, 144, 1800, 3600};
#include<iostream>
using namespace std;
int main()
{
int a[3][3],flag[10]= {0};
int x1,y1;
for(int i=0; i<3; i++)
{
for(int j=0; j<3; j++)
{
cin>>a[i][j];
if(a[i][j]==0)
{
x1=i;
y1=j;
}
else
flag[a[i][j]]=1; // a key !! Be careful
}
}
int p;
for(int i=1; i<=9; i++)
{
if(flag[i]==0)
p=i;
}
a[x1][y1]=p;
//cout<<"wei:"<<p<<endl;
for(int i=0; i<3; i++)
{
int x,y;
cin>>x>>y;
cout<<a[x-1][y-1]<<endl;
}
int x,sum=0;
//cout<<"555"<<endl;
cin>>x;
switch(x)
{
case 1:
sum=a[0][0]+a[0][1]+a[0][2];
break;
case 2:
sum=a[1][0]+a[1][1]+a[1][2];
break;
case 3:
sum=a[2][0]+a[2][1]+a[2][2];
break;
case 4:
sum=a[0][0]+a[1][0]+a[2][0];
break;
case 5:
sum=a[0][1]+a[1][1]+a[2][1];
break;
case 6:
sum=a[0][2]+a[1][2]+a[2][2];
break;
case 7:
sum=a[0][0]+a[1][1]+a[2][2];
break;
case 8:
sum=a[0][2]+a[1][1]+a[2][0];
break;
default:
break;
}
if(sum==6)
cout<<"10000"<<endl;
else if(sum==7)
cout<<"36"<<endl;
else if(sum==8)
cout<<"720"<<endl;
else if(sum==9)
cout<<"360"<<endl;
else if(sum==10)
cout<<"80"<<endl;
else if(sum==11)
cout<<"252"<<endl;
else if(sum==12)
cout<<"108"<<endl;
else if(sum==13)
cout<<"72"<<endl;
else if(sum==14)
cout<<"54"<<endl;
else if(sum==15)
cout<<"180"<<endl;
else if(sum==16)
cout<<"72"<<endl;
else if(sum==17)
cout<<"180"<<endl;
else if(sum==18)
cout<<"119"<<endl;
else if(sum==19)
cout<<"36"<<endl;
else if(sum==20)
cout<<"306"<<endl;
else if(sum==21)
cout<<"1080"<<endl;
else if(sum==22)
cout<<"144"<<endl;
else if(sum==23)
cout<<"1800"<<endl;
else
cout<<"3600"<<endl;
return 0;
}
subject :
“ Scratch the lottery ” It is a small game in an online game . As shown in the figure :

Every time the game player gets a lottery ticket , There will be 9 A digital , They are numbers 1 To digital 9, The numbers do not repeat , And 3×3 Of “ squared paper for practicing calligraphy ” The form is arranged on the lottery .
At the beginning of the game, you can see a number in a position , Numbers in other locations are not visible . You can choose the number of three positions to scrape away , So the player can see the numbers in four positions . Finally, the player starts from 3 cross 、3 vertical 、2 Oblique Co 8 Choose one of the directions , The sum of three numbers in the direction can be cashed according to the following table , Get the corresponding amount of gold coins .
| The figures add up to | Get the gold | The figures add up to | Get the gold |
|---|---|---|---|
| 6 | 10,000 | 16 | 72 |
| 7 | 36 | 17 | 180 |
| 8 | 720 | 18 | 119 |
| 9 | 360 | 19 | 36 |
| 10 | 80 | 20 | 306 |
| 11 | 252 | 21 | 1,080 |
| 12 | 108 | 22 | 144 |
| 13 | 72 | 23 | 1,800 |
| 14 | 54 | 24 | 3,600 |
| 15 | 180 |
Now please write a simulation program , Simulate the player's game process .
Input format :
Enter the first part to give a legal lottery ticket , The box 3 That's ok 3 Column given 0 to 9 The number of .0 It means that the number in this position can be seen at the beginning , Not the number on the lottery is 0.
The second part gives three positions for players to scrape , It's divided into three lines , Each line is formatted x y Give the row number and column number of the position where the player scrapes ( The position in the upper left corner of the title is defined as 1 That's ok 、 The first 1 Column .). The data ensures that the player will not scratch the scratched numbers again .
The last part gives the direction the player chooses , It's an integer : 1 to 3 Indicates the selection of the first horizontal row 、 The second line 、 The third line ,4 to 6 Represents the first vertical column 、 Second column 、 The third column ,7、8 Represent the main diagonal from top left to bottom right and the sub diagonal from top right to bottom left respectively .
Output format :
For every scraping operation , Output the number that the player can see in one line . Finally, for the selected direction , Output the number of gold coins obtained by the player in one line .
sample input :
1 2 3
4 5 6
7 8 0
1 1
2 2
2 3
7
sample output :
1
5
6
180
边栏推荐
- Using celery in projects
- Research Report of exoskeleton robot industry - market status analysis and development prospect prediction
- The vscode waveform curve prompts that the header file cannot be found (an error is reported if the header file exists)
- Understand asp Net core - Authentication Based on jwtbearer
- Stress, anxiety or depression? Correct diagnosis and retreatment
- Communication mode based on stm32f1 single chip microcomputer
- Interface test - knowledge points and common interview questions
- CMPSC311 Linear Device
- Research Report on market supply and demand and strategy of tetramethylpyrazine industry in China
- JS to realize the countdown function
猜你喜欢
![[North Asia data recovery] a database data recovery case where the partition where the database is located is unrecognized due to the RAID disk failure of HP DL380 server](/img/21/513042008483cf21fc66729ae1d41f.jpg)
[North Asia data recovery] a database data recovery case where the partition where the database is located is unrecognized due to the RAID disk failure of HP DL380 server

165 webmaster online toolbox website source code / hare online tool system v2.2.7 Chinese version

Case sharing | integrated construction of data operation and maintenance in the financial industry

Redis' optimistic lock and pessimistic lock for solving transaction conflicts

Intranet penetrating FRP: hidden communication tunnel technology
Detailed explanation of MySQL composite index (multi column index) use and optimization cases
Understand the context in go language in an article

MySQL learning notes - data type (2)

Understand the rate control mode rate control mode CBR, VBR, CRF (x264, x265, VPX)

DIY a low-cost multi-functional dot matrix clock!
随机推荐
Common API day03 of unity script
Principle and general steps of SQL injection
Some fields of the crawler that should be output in Chinese are output as none
Review of Weibo hot search in 2021 and analysis of hot search in the beginning of the year
C language: implementation of daffodil number function
Can I "reverse" a Boolean value- Can I 'invert' a bool?
Accounting regulations and professional ethics [9]
Change the mouse pointer on ngclick - change the mouse pointer on ngclick
Research Report on market supply and demand and strategy of China's well completion equipment industry
In today's highly integrated chips, most of them are CMOS devices
std::shared_ ptr initialization: make_ shared&lt; Foo&gt; () vs shared_ ptr&lt; T&gt; (new Foo) [duplicate]
[book club issue 13] ffmpeg common methods for viewing media information and processing audio and video files
Software Engineer vs Hardware Engineer
Move, say goodbye to the past again
Common knowledge of unity Editor Extension
Research Report of exoskeleton robot industry - market status analysis and development prospect prediction
Understand Alibaba cloud's secret weapon "dragon architecture" in the article "science popularization talent"
The four most common errors when using pytorch
Hair growth shampoo industry Research Report - market status analysis and development prospect forecast
Interpretation of the champion scheme of CVPR 2020 night target detection challenge