งาน
กำหนดmod พับเป็นฟังก์ชั่นในรูปแบบf (x) = x% และ1 % และ2 % ... % ในkที่ฉันเป็นจำนวนเต็มบวกและk ≥ 0 (ที่นี่%เป็นตัวดำเนินการโมดูโลด้านซ้าย)
รับรายการnจำนวนเต็มy 0 , …, y n − 1ตรวจสอบว่ามี mod-fold fเพื่อให้y i = f (i)แต่ละอันหรือไม่
คุณสามารถเลือกและแก้ไขสองเอาต์พุต YและNสำหรับฟังก์ชัน / โปรแกรมของคุณ ถ้ามีอยู่เช่นฉคุณก็ต้องกลับ / พิมพ์ว่าY ; หากไม่เป็นเช่นนั้นคุณจะต้องส่งคืน / พิมพ์Nทุกครั้ง (สิ่งเหล่านี้อาจเป็นtrue
/ false
หรือ1
/ 0
หรือfalse
/ หรือtrue
ฯลฯ ) กล่าวถึงสิ่งเหล่านี้ในคำตอบของคุณ
การส่งที่สั้นที่สุดในหน่วยไบต์ชนะ
ตัวอย่าง
กำหนดf (x) = x% 7% 3 ค่าเริ่มต้น:
| x | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ...
| f(x) | 0 | 1 | 2 | 0 | 1 | 2 | 0 | 0 | 1 | 2 | ...
ดังนั้น0 1 2 0 1 2 0 0 1 2
เมื่อป้อนเข้าสู่โซลูชันของเราเราจะพิมพ์Yเนื่องจากfนี้สร้างลำดับนั้น อย่างไรก็ตาม0 1 0 1 2
ในฐานะอินพุตเราจะพิมพ์Nเนื่องจากไม่มีfสร้างลำดับนั้น
กรณีทดสอบ
สูตรที่กำหนดเมื่อเอาต์พุตคือYใช้สำหรับอ้างอิงเท่านั้น คุณจะต้องไม่พิมพ์พวกเขา
0 1 2 3 4 5 Y (x)
1 N
0 0 0 Y (x%1)
0 1 2 0 1 2 0 0 1 2 Y (x%7%3)
0 0 1 N
0 1 2 3 4 5 6 0 0 1 2 Y (x%8%7)
0 1 2 0 1 2 0 1 2 3 N
0 2 1 0 2 1 0 2 1 N
0 1 0 0 0 1 0 0 0 0 1 Y (x%9%4%3%2)