链接:
#includeusing namespace std;long long n, p2, p3;int main(){ cin >> n >> p2 >> p3; double c2 = p2 / 2.0, c3 = p3 / 3.0; if(n == 1) cout << (long long)(p2 < p3 ? p2 : p3) << "\n"; else if(c2 <= c3){ if(n % 2 == 0){ cout << n / 2 * p2 << "\n"; }else{ long long temp = p3 - p2; temp = temp < p2 ? temp : p2; cout << n / 2 * p2 + temp << "\n"; } }else { if(n%3 == 0){ cout << n / 3 * p3 << "\n"; }else if(n % 3 == 1){ long long temp = p2; temp = temp < p3 ? temp : p3; temp = temp < 2 * p2 - p3 ? temp : 2 * p2 - p3; cout << n/3 * p3 + temp << "\n"; }else if(n % 3 == 2){ long long temp = p2; temp = temp < p3 ? temp : p3; cout << n/3 * p3 + temp << "\n"; } } return 0;}