Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Songnae-algorithm
algorithm
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
algorithm
/
syeon
/
src
/
Test
/
line02.java
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
41 lines (35 loc) · 1.44 KB
master
Breadcrumbs
algorithm
/
syeon
/
src
/
Test
/
line02.java
Copy path
Top
File metadata and controls
Code
Blame
41 lines (35 loc) · 1.44 KB
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
34
35
36
37
38
39
40
41
package
Test
;
public
class
line02
{
public
static
void
main
(
String
[]
args
) {
String
answersheet
=
"4132315142"
;
String
sheet
[] = {
"3241523133"
,
"4121314445"
,
"3243523133"
,
"4433325251"
,
"2412313253"
};
int
max
=
0
;
for
(
int
i
=
0
;
i
<
sheet
.
length
;
i
++) {
// 배열 sheet의 0,1,2,3,4
for
(
int
j
=
i
+
1
;
j
<
sheet
.
length
;
j
++) {
// i , j 두개인 이유는 두 응시자 간의 값을 비교해주어야하기 떄문이다.
int
len
=
0
;
//연속됫을때 길이 찾는거 도와줌
int
cnt
=
0
;
//다른거갯수
int
aa
=
0
;
//연속된거 길이
for
(
int
k
=
0
;
k
<
answersheet
.
length
();
k
++) {
// 요기서 정답 비교
if
(
sheet
[
i
].
charAt
(
k
)==
sheet
[
j
].
charAt
(
k
)&&
sheet
[
i
].
charAt
(
k
)!=
answersheet
.
charAt
(
k
)) {
//정답 i번쨰애랑 j 번째 애랑 같은데, 정답이랑도 다를 때
cnt
++;
//다른거 갯수 판별
len
++;
//
//왜냐면, 여기 드어왔다는 거는 부정행위 한게 하나라도 있다는 거니까! 근데 k가 맨 끝까지 판단했는데도 aa가 0일떄는 aa=1로 바꿔준다.
if
(
aa
==
0
&&
k
==
answersheet
.
length
()-
1
) {
aa
=
1
;
}
}
else
{
//연속된게 끊어졌을떄. len이 그동안 가졌던 값이랑,aa랑 비교해서 큰 거 넣어줌
aa
=
Math
.
max
(
aa
,
len
);
len
=
0
;
//len은 다시 돌떄 리셋되서 돌아야 하니까 !
}
}
max
=
Math
.
max
(
max
,
cnt
+
aa
*
aa
);
}
}
System
.
out
.
println
(
max
);
}
}
You can’t perform that action at this time.