π Day 9 β Teacher's Day Challenge | Team


ποΈ Date: August 02, 2025
π§© Platform: Codeforces
π’ Problems Solved Today: 1
π― Focus Topic: Conditional Logic, Input Handling, Majority Voting
π Table of Contents
Daily Summary
π§© Problem 1 β Team
π Difficulty: Easy
π§ Concepts: Majority Check, Conditional Logic, Input/Output
π Problem Statement (Summary):
Three friends β Petya, Vasya, and Tonya β will solve a problem only if at least two of them are sure about it.
Youβre given n
problems and each problem has 3 integers (0 or 1) indicating whether each friend is sure.
Count how many problems they will implement.
π‘ Approach:
Input number of problems
n
.For each problem, take 3 values (0 or 1) for Petya, Vasya, Tonya.
Sum the three values. If the sum is β₯ 2, increment the answer count.
Finally, print the count.
π§ͺ Code (C++):
#include <iostream>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
while (n--) {
int a, b, c;
cin >> a >> b >> c;
if (a + b + c >= 2) {
ans++;
}
}
cout << ans << endl;
return 0;
}
πΈ Submission Screenshot:
π Example:
Input:
3
1 1 0
1 1 1
1 0 0
Output:
2
β Key Takeaways:
Sum of binary values (0/1) is a quick way to perform majority check.
if (a + b + c >= 2)
is clean and efficient.Looping with
while (n--)
is commonly used in competitive programming.Input format understanding is critical in Codeforces problems.
π Daily Summary
Metric | Value |
Problems Solved | 1 |
Topics Covered | Logic, Binary Input Handling |
Tools Used | C++ |
Next Focus | Arrays, Basic Math |
Day | 9 / 30 |
π·οΈ Tags:#codeforces #conditional #logic #majority #cpp #dsa #43DaysChallenge
Subscribe to my newsletter
Read articles from Tanishi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
