• 个人简介

    AAAAARY3gbRofgWWcrSmopM6U7p3XbJo2ytTGOoFIeN2Em1wQ4Gdj1cl9V5SEOOmFXnNyOJyXqfqh7V7ZrUmDBV/BEAvqlE2S9m2F4PqpzuOBFeONVIoLMAzgLfWEQ7LXqDynjGWoYujt9xxAXRUWN4P2HDV2b2juWoFQIImIYLHXYMPgorLY1t7vPNpHrIYYeUetX/UM3zJSgfhIQcMRrPHPBXRcT1IBlbUDT0X0fONtq9IXMZ40xYEutL8fRB0S4PWG0GpqMEyLs1IXzHemsAgLTskx7Ncte+pi/ydLb9wxesqH/80B1UDaQBn2lLxTGst8kbmqaDV+altcysxq5URo58ejs33G8rb2+qICAIaPyybYxthYxudf6tY42enkdBNguaEGUeeOSnV+8Ec7Coc0ICwDv8w+lay2aaWF3tTcPX3mAsSpvsMXOLKo6LOHpKX3dA3ZHoeg8LFwI0gBQwCr0E=

    AAAAAV8xM0jzPwpqce+87sc4vj6loTqhT6CfZTkoOn9aC2bwsW0wyHOvzYT35XAWi4Mo4/B1vwUtaajb7jkdKo/dAz90H71db8KpPb2Ju2QTELRKl1V/JCDWgtB/zs7xMC7NOnap6kyw176sE/4tou7jf05osF7IFbRdmvgIkKxaT3sxlkbzJ+vb38uEzDjuWOTiSMIWaEmm3ItksfsCqSCI8OJD4Gu11nZ8PD9LBX0WBYlRysElzoyJQWMqfmIWzGWbbSme+uO1+tMUiN9RcyjYMl6McENtYIsy9+qgunBRwYwB7VhVF/Ahy2n6SnoRcdkVlVHwPVVK7dLchSI0RcxHz8YuX+xAv/5NL5NlM8CiyDMPjMebiG2mF/LiyjZg+XzIFogWmNbduDXa//HeCJ815mbKeCnUV1xw+DKitUpAlCVz4R5qiGEiuebLHu6kghyg6t9lzr7sC4+lImIm1YxuT2cLGWNADYcx+GSO4lzgSdLjhKnisfTtdOV7lFgENnriVw4jKtIJ8q9/R05OUoDDMjQABj0F

    #include<bits/stdc++.h>
    #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=10;
    	p2=10;
    	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;
    			}
    		}
    		
    		}system("cls");
    		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;
    				}
    			}
    				
    		}system("cls");
    			if(p2<=0){
    				cout<<"P1赢了";
    				return 0;
    			}
    			if(p1<=0){
    				cout<<"P2赢了";
    				return 0;
    			}
    		}
    		return 0;
    	}
    
    #include <iostream>
    #include <cstring>
    #include <climits>
    using namespace std;
    
    const int MAXN = 205;        
    const long long INF = 1e18;   
    
    long long dist[MAXN][MAXN]; 
    
    int main() {
    
        ios::sync_with_stdio(false);
        cin.tie(0);
        
        int N, M, Q;
        cin >> N >> M >> Q;
        
    
        for (int i = 1; i <= N; ++i) {
            for (int j = 1; j <= N; ++j) {
                if (i == j) {
                    dist[i][j] = 0;
                } else {
                    dist[i][j] = INF;
                }
            }
        }
        
    
        for (int i = 0; i < M; ++i) {
            int u, v, w;
            cin >> u >> v >> w;
    
            if (w < dist[u][v]) {
                dist[u][v] = w;
            }
        }
        
    
        for (int k = 1; k <= N; ++k) {         
            for (int i = 1; i <= N; ++i) {      
                for (int j = 1; j <= N; ++j) {  
    
                    if (dist[i][k] != INF && dist[k][j] != INF) {
                        if (dist[i][j] > dist[i][k] + dist[k][j]) {
                            dist[i][j] = dist[i][k] + dist[k][j];
                        }
                    }
                }
            }
        }
        
    
        for (int i = 0; i < Q; ++i) {
            int S, T;
            cin >> S >> T;
            if (dist[S][T] == INF) {
                cout << "impossible" << endl;
            } else {
                cout << dist[S][T] << endl;
            }
        }
        
        return 0;
    }
    
  • 通过的题目

  • 最近活动

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

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