慕雪少年的数字三角形探险
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Problem Background
In a mysterious digital forest, Muxue the youth discovered a giant number triangle. Legend has it that a treasure is hidden at the bottom of the triangle, but it can only be obtained by finding a special path. The sum of the numbers along this path has a special requirement: its remainder modulo 7 must be minimal.
Problem Description
Muxue has a number triangle, where the i-th row contains i numbers. Starting from the top, one can move to one of the two adjacent numbers in the next row each time, until reaching the bottom.
Muxue wants to find a path such that the remainder of the sum of the numbers along the path modulo 7 is minimized. If multiple paths have the same remainder, choose the one with the largest sum.
Input Format
First line: An integer n (1 ≤ n ≤ 1000), representing the number of rows in the triangle.
Next n lines: The i-th line contains i integers, representing the numbers in the triangle (0 ≤ a_ij ≤ 10^9).
Output Format
Two integers, separated by a space: the minimal remainder and the corresponding maximum sum.
Sample Input and Output #1
Input #1
3
1
2 3
4 5 6
Output #1
0 10
Explanation/Notes
Explanation for Sample 1:
The path 1→2→5 has sum 8, remainder 1;
The path 1→3→6 has sum 10, remainder 3;
The path 1→2→4 has sum 7, remainder 0.
Therefore, the minimal remainder is 0, and the corresponding maximum sum is 10.
This problem uses Subtask bundled testing
【XJS-C5-Div5】XJSOI 春节大月赛 Round 3 & 勰码可达鸭合作赛 Round 1
- 状态
- 已结束
- 规则
- IOI
- 题目
- 5
- 开始于
- 2026-2-7 0:00
- 结束于
- 2026-2-14 0:00
- 持续时间
- 2 小时
- 主持人
- 参赛人数
- 10