版本比较
Card Game
正文
增加 171 行删除 7 行
143 行未改动全部展开144145146147148149150151152153154148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323143 行未改动全部展开 pts+=8; } cout<<"Final Points : "<<pts<<endl; cout<<endl; if(pts==0) cout<<"Common\n"; else if(pts==1) cout<<"Uncommon\n"; else if(pts==2) cout<<"Rare\n"; else if(3<=pts&&pts<=4) cout<<"Epic\n"; else if(5<=pts&&pts<=8) cout<<"Anomaly\n"; else if(pts==9) cout<<"Mythic\n"; else if(pts==10) cout<<"TOP1!!!!!\n"; if(pts==0) cout<<"Trash\n"; else if(pts==1) cout<<"Common\n"; else if(pts==2) cout<<"Uncommon\n"; else if(3<=pts&&pts<=4) cout<<"Rare\n"; else if(5<=pts&&pts<=8) cout<<"Epic\n"; else if(pts==9) cout<<"Anomaly\n"; else if(pts==10) cout<<"Mythic\n"; cout<<endl; } }
```概率
```cpp#include<bits/stdc++.h>#define endl '\n'using namespace std;string ch[4][2]={{"L","Y"},{"A","G"},{"L","M"},{"A","Gay"}};int cnt[7];int main(){ srand(time(0)); cout<<"GENERATE → Card spread generated\n"; cout<<endl; int T=1000000;// cin>>T; while(T--){// string str;// cin>>str;// if(str!="GENERATE"){// cout<<"You are gay!\n";// continue;// } int t=rand()%24; int s=rand()%16; int a[4]={1,2,3,4}; int b[4]={0,0,0,0}; while(t--){ next_permutation(a,a+4); } int now=0; while(s){ b[now]=s%2; s/=2; now++; } string st; int pts=0; for(int i=0;i<4;++i){ st+=ch[a[i]-1][b[i]];// cout<<ch[a[i]-1][b[i]]<<' '; }// cout<<endl<<endl; for(int i=0;i<st.size()-1;++i){ if(st[i]=='L'&&st[i+1]=='A'){// cout<<"Common +1\n";// cout<<endl;// cout<<"LA\n";// cout<<endl; pts+=1; } } if(st.find("MY")!=-1){// cout<<"Common +1\n";// cout<<endl;// cout<<"MY\n";// cout<<endl; pts+=1; } if(st.find("Gay")!=-1){// cout<<"Common +1\n";// cout<<endl;// cout<<"Gay\n";// cout<<endl; pts+=1; } if(st.find("GYM")!=-1){// cout<<"Uncommon +2\n";// cout<<endl;// cout<<"GYM\n";// cout<<endl; pts+=2; } if(st.find("LGM")!=-1){// cout<<"Uncommon +2\n";// cout<<endl;// cout<<"LGM\n";// cout<<endl; pts+=2; } if(st.find("GAY")!=-1){// cout<<"Rare +3\n";// cout<<endl;// cout<<"GAY\n";// cout<<endl; pts+=3; } if(st.find("YAG")!=-1){// cout<<"Rare +3\n";// cout<<endl;// cout<<"YAG\n";// cout<<endl; pts+=3; } if(st.find("LALA")!=-1){// cout<<"Epic +4\n";// cout<<endl;// cout<<"LALA\n";// cout<<endl; pts+=4; } if(st.find("GayGAY")!=-1){// cout<<"Epic +4\n";// cout<<endl;// cout<<"GayGAY\n";// cout<<endl; pts+=4; } if(st.find("GAYGay")!=-1){// cout<<"Epic +4\n";// cout<<endl;// cout<<"GAYGay\n";// cout<<endl; pts+=4; } if(st.find("GayYAG")!=-1){// cout<<"Epic +4\n";// cout<<endl;// cout<<"GayYAG\n";// cout<<endl; pts+=4; } if(st.find("YAGGay")!=-1){// cout<<"Epic +4\n";// cout<<endl;// cout<<"YAGGay\n";// cout<<endl; pts+=4; } if(st.find("LGMGay")!=-1){// cout<<"Anomaly +6\n";// cout<<endl;// cout<<"LGMGay\n";// cout<<endl; pts+=6; } if(st.find("GayLGM")!=-1){// cout<<"Anomaly +6\n";// cout<<endl;// cout<<"GayLGM\n";// cout<<endl; pts+=6; } if(st.find("LAGayM")!=-1){// cout<<"Mythic +8\n";// cout<<endl;// cout<<"LAGayM\n";// cout<<endl; pts+=8; }// cout<<"Final Points : "<<pts<<endl;// cout<<endl; if(pts==0) cnt[0]++; else if(pts==1) cnt[1]++; else if(pts==2) cnt[2]++; else if(3<=pts&&pts<=4) cnt[3]++; else if(5<=pts&&pts<=8) cnt[4]++; else if(pts==9) cnt[5]++; else if(pts==10) cnt[6]++;// cout<<endl; } for(int i=0;i<7;++i) cout<<cnt[i]*1.0/1000000.0<<' ';} ```