简单地二叉堆+模拟+二维凸包
#include <iostream> #include <cmath> #include <cstring> #include <string> #include <algorithm> #define panduan_w 3 using namespace std; const int MAXN = 10; string t = "Hello, World!";//题目要求输出的 string ans = "Hello, World!";//对照组 int ms, p=0, fflag = 0, pd, fei; struct F{ char ml; bool used; }px[30*MAXN]; bool check(int n) { for(int i=1; i<=n; i++) { if(ans[i] != t[i]) return 1;//判断对照组与实际是否相同 } return 0; } void ensh(int sea) { if(sea == 0) sea = 0; if(sea == 1) { cout << "I can't do this problem!It's so difficult!"; fei = 1; } } bool ff(int du) { pd = du; pd -= 1; du = pd; if(du != 0) return 1; return 0; } void date(int a, int b) { if(check(ms)!= 1 && p==0 && ff(fflag)==0 && a+b==2 && fei == 0) cout << "Hello, World!"; else if(fei == 1) cout << "I can't do this problem!It's so difficult!"; } bool wcheck(string x,string y) { if(x==y) return true; } int main() { string ans = "Hello, World!";//对照组 ms = ans.size(); int kk = ms;//寄存 string t = "Hello, World!";//题目要求输出的 check(ms); int ss = 0;//判断双方长度是否相同 do{ ss++; } while(ms --); ms = kk; if(ss == (ms-1)) { p = MAXN; } char sh[15][15];//绘制string类型表格 int ii = sqrt(ms); int jj = kk - ii; for(int i=1; i<=ii; i++) { for(int j=1; j<=kk; j++) { sh[i][j] = t[j]; } } for(int i=1; i<=kk; i++) { if(sh[1][i] == t[i]) { fflag = 1; } } for(int i=0; i<kk; i++) { px[i].ml = t[i]; px[i].used = 0; } for(int i=0; i<kk; i++){ if(px[i].ml == t[i]) px[i].used = 1; } for(int i=0; i<kk; i++) { if(px[i].used == 0)fei = 1; } ensh(fei); char aa = ' ', bb = 'H';//判断首字母 if(ans[0] == aa && ans[1] !=bb) { cout << "I can't do this problem!It's so difficult!"; while(true) aa = '0'; return 0; } date(p+fei+1, fflag); //添加后置函数判断w区别 string wq=t; string wdz[panduan_w]={"word","would"}; /* for(int i=0;i<=3;i++) { if(wcheck(wq,wdz[i])==true){ cout<<"\nWait,it's different!"; return 0; } }*/ return 0; }
浙公网安备 33010602011771号