File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
s3623_count_number_of_trapezoids_i
s3625_count_number_of_trapezoids_ii Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,9 @@ public int countTrapezoids(int[][] points) {
15
15
}
16
16
long sum = 0L ;
17
17
long sumPairs = 0L ;
18
- for (int c : map .values ()) {
19
- if (c > 1 ) {
20
- long pairs = ((long ) c * (c - 1 ) / 2 ) % mod ;
18
+ for (Integer num : map .values ()) {
19
+ if (num > 1 ) {
20
+ long pairs = ((long ) num * (num - 1 ) / 2 ) % mod ;
21
21
sum = (sum + pairs ) % mod ;
22
22
sumPairs = (sumPairs + pairs * pairs % mod ) % mod ;
23
23
}
Original file line number Diff line number Diff line change @@ -101,9 +101,9 @@ public int countTrapezoids(int[][] points) {
101
101
}
102
102
long s = 0 ;
103
103
long s2 = 0 ;
104
- for (int c : lines .values ()) {
105
- s += c ;
106
- s2 += (long ) c * c ;
104
+ for (Integer line : lines .values ()) {
105
+ s += line ;
106
+ s2 += (long ) line * line ;
107
107
}
108
108
trapezoidsRaw += (s * s - s2 ) / 2 ;
109
109
}
@@ -114,9 +114,9 @@ public int countTrapezoids(int[][] points) {
114
114
}
115
115
long s = 0 ;
116
116
long s2 = 0 ;
117
- for (int c : mp .values ()) {
118
- s += c ;
119
- s2 += (long ) c * c ;
117
+ for (Integer num : mp .values ()) {
118
+ s += num ;
119
+ s2 += (long ) num * num ;
120
120
}
121
121
parallelograms += (s * s - s2 ) / 2 ;
122
122
}
You can’t perform that action at this time.
0 commit comments