QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 1024 MB

#23932. ตรวจสอบผลรวม

统计

โจทย์ปัญหา

กำหนดจำนวนเต็มบวก $3$ จำนวน คือ $A, B, C$

หากมีค่าใดค่าหนึ่งเพียง $1$ ค่าที่มีค่าเท่ากับผลรวมของอีก $2$ ค่าที่เหลือ ให้แสดงผลเป็น $1$ มิฉะนั้นให้แสดงผลเป็น $0$

ข้อจำกัด

  • $1 \le A \le 100$
  • $1 \le B \le 100$
  • $1 \le C \le 100$
  • ค่าที่รับเข้ามาทั้งหมดเป็นจำนวนเต็ม

ข้อมูลนำเข้า

ข้อมูลนำเข้าจะกำหนดให้ในรูปแบบต่อไปนี้:

A
B
C

ข้อมูลส่งออก

หากมีค่าใดค่าหนึ่งเพียง $1$ ค่าที่มีค่าเท่ากับผลรวมของอีก $2$ ค่าที่เหลือ ให้แสดงผลเป็น $1$ มิฉะนั้นให้แสดงผลเป็น $0$

ห้ามแสดงสิ่งอื่นใดนอกจากผลลัพธ์ (ห้ามแสดงข้อความแจ้งให้ป้อนข้อมูล ฯลฯ)

สำหรับรูปแบบคำตอบ สามารถดูอ้างอิงได้จากโจทย์ฝึกหัดและตัวอย่างคำตอบ

ตัวอย่างที่ 1

ตัวอย่างข้อมูลนำเข้า 1

3
5
2

ตัวอย่างข้อมูลส่งออก 1

1
  • เนื่องจาก $B=5$ เท่ากับผลรวมของอีก $2$ ค่าที่เหลือคือ $A=3$ และ $C=2$ จึงแสดงผลเป็น $1$

ตัวอย่างที่ 2

ตัวอย่างข้อมูลนำเข้า 2

2
3
4

ตัวอย่างข้อมูลส่งออก 2

0
  • $A=2$ ไม่เท่ากับผลรวมของอีก $2$ ค่าที่เหลือคือ $B=3$ และ $C=4$ ซึ่งมีค่าเป็น $7$
  • $B=3$ ไม่เท่ากับผลรวมของอีก $2$ ค่าที่เหลือคือ $A=2$ และ $C=4$ ซึ่งมีค่าเป็น $6$
  • $C=4$ ไม่เท่ากับผลรวมของอีก $2$ ค่าที่เหลือคือ $A=2$ และ $B=3$ ซึ่งมีค่าเป็น $5$
  • ดังนั้น เนื่องจากไม่มีค่าใดเลยที่เท่ากับผลรวมของอีก $2$ ค่าที่เหลือ จึงแสดงผลเป็น $0$

ตัวอย่างที่ 3

ตัวอย่างข้อมูลนำเข้า 3

100
50
50

ตัวอย่างข้อมูลส่งออก 3

1
  • เนื่องจาก $A=100$ เท่ากับผลรวมของอีก $2$ ค่าที่เหลือคือ $B=50$ และ $C=50$ จึงแสดงผลเป็น $1$

ตัวอย่างที่ 4

ตัวอย่างข้อมูลนำเข้า 4

1
1
1

ตัวอย่างข้อมูลส่งออก 4

0
  • เนื่องจากไม่มีค่าใดเลยที่เท่ากับผลรวมของอีก $2$ ค่าที่เหลือ จึงแสดงผลเป็น $0$

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.