QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21154. תתי־סדרות שסכומן כפולה של שבע

Statistics

$N$ הפרות של Farmer John עומדות בשורה, כפי שהן נוטות לעשות מדי פעם. לכל פרה יש מזהה שלם שונה כדי ש־FJ יוכל להבחין ביניהן. FJ רוצה לצלם קבוצה רציפה של פרות, אך בגלל אירוע טראומטי בילדותו הקשור למספרים $1 \ldots 6$, הוא רוצה לצלם קבוצה רק אם סכום המזהים שלה הוא כפולה של $7$.

עזרו ל־FJ לקבוע את גודל הקבוצה הגדולה ביותר שיוכל לצלם.

קלט

השורה הראשונה מכילה את $N$ ($1 \leq N \leq 50,000$). כל אחת מ־$N$ השורות הבאות מכילה את $N$ המזהים השלמים של הפרות (כולם בטווח $0 \ldots 1,000,000$).

פלט

הדפיסו את מספר הפרות בקבוצה הרציפה הגדולה ביותר שסכום מזהיה הוא כפולה של $7$. אם אין קבוצה כזאת, הדפיסו 0.

שימו לב שסכום המזהים של קבוצה גדולה של פרות עלול להיות גדול מדי למספר שלם רגיל בן 32 סיביות. לכן, אם אתם מסכמים מזהים רבים, תוכלו להשתמש בטיפוס שלם גדול יותר, כמו long long בן 64 סיביות ב־C/C++.

דוגמאות

קלט 1

7
3
5
1
6
2
14
10

פלט 1

5

הערה

בדוגמה הזאת, $5+1+6+2+14 = 28$.

מחבר הבעיה: Brian Dean

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.