MCPcopy Create free account
hub / github.com/E869120/math-algorithm-book / main

Function main

codes/cpp/Code_5_09_2.cpp:8–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6int Current_Time = 0, Answer = 0; // Current_Time �͌��ݎ����i���O�Ɍ����f��̏I�������j
7
8int main() {
9 // ����
10 cin >> N;
11 for (int i = 1; i <= N; i++) cin >> L[i] >> R[i];
12
13 // �f��̑I�ѕ��̃V�~�����[�V����
14 // �����f��̏I�������̍ŏ��l min_endtime �͍ŏ� 1000000 �̂悤�Ȃ��蓾�Ȃ��l�ɐݒ肷��
15 while (true) {
16 int min_endtime = 1000000;
17 for (int i = 1; i <= N; i++) {
18 if (L[i] < Current_Time) continue;
19 min_endtime = min(min_endtime, R[i]);
20 }
21 if (min_endtime == 1000000) break;
22 Current_Time = min_endtime;
23 Answer += 1;
24 }
25
26 // �����̏o��
27 cout << Answer << endl;
28 return 0;
29}

Callers

nothing calls this directly

Calls 1

minFunction · 0.85

Tested by

no test coverage detected