$ NOIP2009 $ explanations report

table of Contents

• $ Luogu \ P1071 $ Lurker $ (\ √ \) $

• $ Luogu \ P1072 $ $ Hankson $ interesting question $ (\ \ \) $

• $ Luogu \ P1073 $ Optimal Trade $ (\ \ \) $

• $ Luogu \ P1074 $ target-shaped Sudoku $ (\ \ \) $


 

$ Luogu \ P1071 $ Lurker

Topic Portal

Topic is water, it can direct simulation, note the details

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 string x,y,z;
 4 int sum[27],tot=0;
 5 bool b1[27],b2[27];
 6 int main(){
 7     cin>>x>>y>>z;
 8     for(int i=0;i<x.size();++i)
 9     {
10         if(!b1[x[i]-'A'+1]&&!b2[y[i]-'A'+1])
11         {
12             sum[x[i]-'A'+1]=y[i];
13             b1[x[i]-'A'+1]=b2[y[i]-'A'+1]=true;
14             ++tot;
15         }    
16         else if(sum[x[i]-'A'+1]!=y[i])
17         {
18             cout<<"Failed";
19             return 0;    
20         }
21     }
22     if(tot!=26)
23     {
24         cout<<"Failed";
25             return 0;    
26     }
27     for(int i=0;i<z.size();++i)
28     {
29         printf("%c",sum[z[i]-'A'+1]);    
30     }
31 }
Code poke here

 

$ Luogu \ P1072 $ $ Hankson $ tastes title

Topic Portal

 

 


 

$ Luogu \ P1073 $ optimal trade

Topic Portal

 

 


 

$ Luogu \ P1074 $ target-shaped Sudoku

Topic Portal

 

 

Guess you like

Origin www.cnblogs.com/THWZF/p/11741826.html