[语言月赛 202507] 购票

Luogu
IDLGB4364
Time1000ms
Memory512MB
DifficultyP1
2025分支结构语言月赛
H 市 W 公园的门票分为单次票和年票,单次票的售价为 $a$ 元,年票的售价为 $b$ 元。若购买年票,则可以在今年无限次进入公园。 今年你想去 $n$ 次 W 公园,你最少要花多少钱购买门票? ## Input 输入一行三个由空格分隔的非负整数 $n,a,b$。 ## Output 输出一行一个整数,表示购买门票的最少花费。 [samples] ## Note ### 样例 1 解释 如果购买单次门票,则总花费为 $100\times 1=100$ 元。 如果购买年票,则总花费为 $50$ 元。 因此购买年票可以使总花费最少,最少花费为 $50$ 元。 ### 样例 2 解释 如果购买单次门票,则总花费为 $2\times 10=20$ 元。 如果购买年票,则总花费为 $50$ 元。 因此购买单次门票可以使总花费最少,最少花费为 $20$ 元。 ### 样例 3 解释 请注意答案可能超过 `int` 类型所能表示的范围。 ### 样例 4 解释 输入的数据中可能含有 $0$。 ### 数据范围与约定 对于全部数据,满足 $0\le a,b,n\le 10^{18}$。各测试点的详细数据范围见下表。 | 测试点 | 特殊性质 | | :---: | :---: | | $1\sim 12$ | $0\le a,b,n\le 10^4$ | | $13\sim 16$ | $0\le a,b,n\le 10^9$ | | $17\sim 20$ | 无 |
Samples
Input #1
100 1 50
Output #1
50
Input #2
2 10 50
Output #2
20
Input #3
987654321 123456789 999999999999999999
Output #3
121932631112635269
Input #4
0 100 200
Output #4
0
API Response (JSON)
{
  "problem": {
    "name": "[语言月赛 202507] 购票",
    "description": {
      "content": "H 市 W 公园的门票分为单次票和年票,单次票的售价为 $a$ 元,年票的售价为 $b$ 元。若购买年票,则可以在今年无限次进入公园。 今年你想去 $n$ 次 W 公园,你最少要花多少钱购买门票?",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB4364"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "H 市 W 公园的门票分为单次票和年票,单次票的售价为 $a$ 元,年票的售价为 $b$ 元。若购买年票,则可以在今年无限次进入公园。\n\n今年你想去 $n$ 次 W 公园,你最少要花多少钱购买门票?\n\n## Input\n\n输入一行三个由空格分隔的非负整数 $n,a,b$。\n\n## Output\n\n输出一行一个整数,表示购买门票的最少花费。\n\n[samples]\n\n## Note\n\n### 样例 1...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments