• 个人简介

    #pragma GCC optimize(3,"Ofast","inline")
    using namespace std;
    typedef long long ll;
    ll p1=4,p2=4,a1,a2,r,d1,d2,z,s1,s2,x,zz;
    int getRand(int min, int max) {
    return (rand() % (max - min + 1)) + min;
    }
    int main(){
    p1=p2=1;
    p1=100;
    p2=1;
    cout<<"P1 HP:"<<p1<<endl;
    cout<<"P2 HP:"<<p2<<endl;
    z=0;
    while(1){
    z++;
    x++;
    zz++;
    cout<<"!!!!!!!!!!!!!!!第"<<x<<"回合!!!!!!!!!!!!!!!!"<<endl;
    if(z==3){
    cout<<endl<<"###############分发放大镜###############" <<endl ;
    d1++;
    d2++;
    z=0;
    }
    srand(time(0));
    cout<<"--------------------P1的回合--------------------"<<endl<<endl;
    cout<<"P1 HP:"<<p1<<endl;
    cout<<"p1 放大镜:"<<d1<<endl<<endl;
    while(1){
    r=getRand(0,1);
    if(d1>0){
    cout<<"是否使用放大镜"<<endl<<endl<<"1:是   2:否"<<endl;
    cin>>s1;
    if(s1==1){
    d1--;
    if(r==1){
    cout<<"下一发子弹是(实弹)"<<endl<<endl;
    }
    else{
    cout<<"下一发子弹是(空弹)"<<endl<<endl;
    }
    }
    }
    cout<<"打自己还是打别人"<<endl<<endl;
    cout<<"1:打别人   2:打自己"<<endl;
    cin>>a1;
    if(a1==1){
    if(r==1){
    p2--;
    cout<<"P2 HP-1"<<endl;
    }
    else {
    break;
    }
    }
    else if(a1==2){
    if(r==1){
    p1--;
    cout<<"P1 HP-1"<<endl;
    break;
    }
    else{
    p1++;
    cout<<"P1 HP+1"<<endl;
    }
    }
    }
    cout<<"--------------------P2的回合--------------------"<<endl<<endl ;
    cout<<"P2"<<" HP:"<<p2<<endl;
    cout<<"p2 放大镜:"<<d2<<endl<<endl;
    while(1){
    r=getRand(0,1);
    if(d2>0){
    cout<<"是否使用放大镜"<<endl<<endl<<"1:是   2:否"<<endl;
    cin>>s2;
    if(s2==1){
    d2--;
    if(r==1){
    cout<<"下一发子弹是(实弹)"<<endl<<endl;
    }
    else{
    cout<<"下一发子弹是(空弹)"<<endl<<endl;
    }
    }
    }
    cout<<"打自己还是打别人"<<endl<<endl;
    cout<<"1:打别人   2:打自己"<<endl;
    cin>>a1;
    if(a1==1){
    if(r==1){
    p1--;
    cout<<"P1 HP-1"<<endl;
    }
    else break;
    }
    else if(a1==2){
    if(r==1){
    p2--;
    cout<<"P2 HP-1"<<endl;
    break;
    }
    else{
    p2++;
    cout<<"P2 HP+1"<<endl;
    }
    }
    }```
    if(p2<=0){
    cout<<"P1赢了";
    return 0;
    }
    if(p1<=0){
    cout<<"P2赢了";
    return 0;
    }
    }
    return 0;
    }
    
    
    
    
  • 通过的题目

  • 最近活动

    This person is lazy and didn't join any contests or homework.
  • 最近编写的题解

    This person is lazy and didn't write any solutions.