Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
import java.util.Collection; import java.util.Scanner; public class MAin { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); // brojot na filmovi int[][] filmovi = new int[n][2]; for(int i = 0; i < n; i++) { filmovi[i][0] = sc.nextInt(); filmovi[i][1] = sc.nextInt(); } for(int i = 0; i < n; i++) { for(int j = i + 1; j < n; j++) { int tmp1 = filmovi[i][0]; int tmp2 = filmovi[i][1]; if(filmovi[i][1] > filmovi[j][1]) { filmovi[i][0] = filmovi[j][0]; filmovi[i][1] = filmovi[j][1]; filmovi[j][0] = tmp1; filmovi[j][1] = tmp2; } } } int broj_na_filmovi = 0; int posledno_vreme_na_zavrsuvanje = -1; for(int i = 0; i < n; i++) { if(filmovi[i][0] >= posledno_vreme_na_zavrsuvanje) { broj_na_filmovi++; posledno_vreme_na_zavrsuvanje = filmovi[i][1]; } } System.out.println(broj_na_filmovi); } } // 158
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)