#34344: c++ 用sort找最大值


yp11151208@yphs.tp.edu.tw (805-42葉宏湧)

學校 : 臺北市私立延平高級中學
編號 : 197051
來源 : [203.72.178.1]
最後登入時間 :
2023-09-24 09:29:19
f045. 3. 身分驗證機制 (Verification) -- 2020年4月TOI練習賽新手組 | From: [39.12.9.25] | 發表日期 : 2023-03-12 18:16

#include<bits/stdc++.h>
using namespace std;
main(){
    int n[9],m,a,i; string s;
    while(cin>>s){
        for(i=0;i<9;i++) n[i]=s[i]-48;
        a=n[6]*100+n[7]*10+n[8];
        sort(n,n+9);
        m=n[7]*n[7]+n[8]*n[8];
        if(a==m) cout<<"Good Morning!\n";
        else cout<<"SPY!\n";
    }
}

 
ZeroJudge Forum