結果
| 問題 |
No.920 あかあお
|
| コンテスト | |
| ユーザー |
LayCurse
|
| 提出日時 | 2019-11-10 18:29:11 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 2,000 ms |
| コード長 | 2,085 bytes |
| コンパイル時間 | 2,473 ms |
| コンパイル使用メモリ | 209,860 KB |
| 最終ジャッジ日時 | 2025-01-08 03:50:06 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
ソースコード
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S min_L(S a,T b){
return a<=b?a:b;
}
inline void rd(int &x){
int k;
int m=0;
x=0;
for(;;){
k = getchar_unlocked();
if(k=='-'){
m=1;
break;
}
if('0'<=k&&k<='9'){
x=k-'0';
break;
}
}
for(;;){
k = getchar_unlocked();
if(k<'0'||k>'9'){
break;
}
x=x*10+k-'0';
}
if(m){
x=-x;
}
}
inline void wt_L(char a){
putchar_unlocked(a);
}
inline void wt_L(int x){
int s=0;
int m=0;
char f[10];
if(x<0){
m=1;
x=-x;
}
while(x){
f[s++]=x%10;
x/=10;
}
if(!s){
f[s++]=0;
}
if(m){
putchar_unlocked('-');
}
while(s--){
putchar_unlocked(f[s]+'0');
}
}
inline void wt_L(unsigned x){
int s=0;
char f[10];
while(x){
f[s++]=x%10;
x/=10;
}
if(!s){
f[s++]=0;
}
while(s--){
putchar_unlocked(f[s]+'0');
}
}
inline void wt_L(long long x){
int s=0;
int m=0;
char f[20];
if(x<0){
m=1;
x=-x;
}
while(x){
f[s++]=x%10;
x/=10;
}
if(!s){
f[s++]=0;
}
if(m){
putchar_unlocked('-');
}
while(s--){
putchar_unlocked(f[s]+'0');
}
}
inline void wt_L(unsigned long long x){
int s=0;
char f[21];
while(x){
f[s++]=x%10;
x/=10;
}
if(!s){
f[s++]=0;
}
while(s--){
putchar_unlocked(f[s]+'0');
}
}
inline void wt_L(double x){
printf("%.15f",x);
}
inline void wt_L(const char c[]){
int i=0;
for(i=0;c[i]!='\0';i++){
putchar_unlocked(c[i]);
}
}
inline void wt_L(string &x){
int i=0;
for(i=0;x[i]!='\0';i++){
putchar_unlocked(x[i]);
}
}
int X;
int Y;
int Z;
int main(){
int k;
rd(X);
rd(Y);
rd(Z);
k =min_L(abs(X-Y), Z);
if(X > Y){
Y+= k;
}
else{
X+= k;
}
Z -= k;
wt_L(min_L(X, Y)+ Z/2);
wt_L('\n');
return 0;
}
// cLay varsion 20191108-1
// --- original code ---
// int X, Y, Z;
// {
// int k;
// rd(X,Y,Z);
// k = min(abs(X-Y), Z);
// if[X > Y, Y, X] += k;
// Z -= k;
// wt( min(X,Y) + Z/2 );
// }
LayCurse