InTheBloodHorse

每日一题(48) codeforces1091A

字数统计: 93阅读时长: 1 min
2019/01/11 Share

题目地址

题意

给三个数字,abc,在不大于abc的数值下,输出abc为等差数列,差值为1的最大值,例如,13,5,6,答案为4+5+6

AC代码:

1
2
3
4
5
6
7
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin >> a >> b >> c;
cout << min(min(b,a+1),c-1) * 3 << endl;
}

原文作者:InTheBloodHorse

原文链接:http://pyking.cn/2019/01/11/每日一题-48-codeforces1091A/

发表日期:January 11th 2019, 7:11:57 pm

更新日期:January 11th 2019, 7:15:43 pm

版权声明:Have a fun

CATALOG
  1. 1. 题意