FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java/Code-Forces/src/cat_party.java at master · javaarchive/Java · GitHub
This repository was archived by the owner on Feb 29, 2024. It is now read-only.
javaarchive
/
Java
Public archive
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Issues
0
Pull requests
3
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Java
/
Code-Forces
/
src
/
cat_party.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
33 lines (29 loc) · 924 Bytes
Breadcrumbs
Java
/
Code-Forces
/
src
/
cat_party.java
Copy path
File metadata and controls
33 lines (29 loc) · 924 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import
java
.
util
.*;
public
class
cat_party
{
public
static
void
main
(
String
[]
args
) {
Scanner
sc
=
new
Scanner
(
System
.
in
);
int
N
=
sc
.
nextInt
();
int
[]
days
=
new
int
[
N
];
for
(
int
i
=
0
;
i
<
N
;
i
++) {
days
[
i
] =
sc
.
nextInt
();
}
HashMap
<
Integer
,
Integer
>
freq
=
new
HashMap
<
Integer
,
Integer
>();
int
out
=
N
;
for
(
int
i
=
0
;
i
<
N
;
i
++) {
freq
.
putIfAbsent
(
days
[
i
],
0
);
freq
.
put
(
days
[
i
],
freq
.
get
(
days
[
i
])+
1
);
//System.out.println(freq);
Set
<
Integer
>
values
=
new
HashSet
<
Integer
>(
freq
.
values
());
//System.out.println("Map "+values.size()+" i = "+i+" "+values);
if
(
values
.
size
() ==
2
) {
//System.out.println("Day "+i);
out
=
i
+
1
;
}
}
Set
<
Integer
>
values
=
new
HashSet
<
Integer
>(
freq
.
values
());
//System.out.println("Map "+values.size()+" i = "+N+" "+values);
//System.out.println(freq);
System
.
out
.
println
(
out
);
sc
.
close
();
}
}
Back
|
FazBrowse Home
|
New Git URL