標題:
[測驗紀錄] 2025/05/24
[打印本頁]
作者:
方浩葦
時間:
昨天 20:00
標題:
[測驗紀錄] 2025/05/24
1. 基礎題庫:a043 棄保效應
作者:
許浩浩
時間:
6 小時前
#include<bits/stdc++.h>
using namespace std;
struct P
{
char s;
long long int v;
};
bool cmp(P p1,P p2)
{
return p1.v<p2.v;
}
int main()
{
cin.tie(0);
cin.sync_with_stdio(0);
long int a,b,c;
while(cin>>a>>b>>c)
{
P p[3];
p[0].s='A';
p[1].s='B';
p[2].s='C';
p[0].v=a;
p[1].v=b;
p[2].v=c;
sort(p,p+3,cmp);
if(p[0].v+p[1].v>p[2].v)
cout<<p[1].s<<endl;
else
cout<<p[2].s<<endl;
}
return 0;
}
複製代碼
作者:
郭博鈞
時間:
6 小時前
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
struct P
{
string s;
int n;
};
bool compare(P p1,P p2)
{
return p1.n<p2.n;
}
int main()
{
cin.tie(0);
cin.sync_with_stdio(0);
while(cin>>a>>b>>c)
{
P p[3];
p[0].s="A";
p[0].n=a;
p[1].s="B";
p[1].n=b;
p[2].s="C";
p[2].n=c;
sort(p,p+3,compare);
if(p[0].n+p[1].n>p[2].n)
cout<<p[1].s<<endl;
else
cout<<p[2].s<<endl;
}
return 0;
}
複製代碼
作者:
黃暐鈞
時間:
6 小時前
#include<bits/stdc++.h>
using namespace std;
int main()
{
long int a,b,c;
while(cin>>a>>b>>c)
{
pair<long long int,char> candidate[3];
candidate[0]={a,'A'};
candidate[1]={b,'B'};
candidate[2]={c,'C'};
sort(candidate,candidate+3);
if(candidate[0].first+candidate[1].first>candidate[2].first)
{
cout<<candidate[1].second<<endl;
}
else
{
cout<<candidate[2].second<<endl;
}
}
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2