diff --git a/InSange/README.md b/InSange/README.md index 9513d03..6e73fbf 100644 --- a/InSange/README.md +++ b/InSange/README.md @@ -28,6 +28,7 @@ | 24차시 | 2024.08.04 | BFS | [트리](https://www.acmicpc.net/problem/1068) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/83)] | 25차시 | 2024.08.10 | BFS | [Minimum Height Trees](https://leetcode.com/problems/minimum-height-trees/) | [#25](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/87)] | 26차시 | 2024.08.11 | 수학 | [Magic Squares In Grid](https://leetcode.com/problems/magic-squares-in-grid/) | [#26](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/89)] +| 27차시 | 2024.08.17 | 문자열 | [Number of Senior Citizens](https://leetcode.com/problems/number-of-senior-citizens/) | [#27](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/91)] --- https://leetcode.com/problems/robot-collisions/ diff --git "a/InSange/\353\254\270\354\236\220\354\227\264/2678_Number of Senior Citizens.cpp" "b/InSange/\353\254\270\354\236\220\354\227\264/2678_Number of Senior Citizens.cpp" new file mode 100644 index 0000000..656e589 --- /dev/null +++ "b/InSange/\353\254\270\354\236\220\354\227\264/2678_Number of Senior Citizens.cpp" @@ -0,0 +1,24 @@ +#include +#include + +using namespace std; + +class Solution { +public: + int countSeniors(vector& details) { + int seniorCount = 0; + + for (string& passengerInfo : details) { + int ageTens = passengerInfo[11] - '0'; + int ageOnes = passengerInfo[12] - '0'; + + int age = ageTens * 10 + ageOnes; + + if (age > 60) { + seniorCount++; + } + } + + return seniorCount; + } +}; \ No newline at end of file