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) {
1515 }
1616 long sum = 0L ;
1717 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 ;
2121 sum = (sum + pairs ) % mod ;
2222 sumPairs = (sumPairs + pairs * pairs % mod ) % mod ;
2323 }
Original file line number Diff line number Diff line change @@ -101,9 +101,9 @@ public int countTrapezoids(int[][] points) {
101101 }
102102 long s = 0 ;
103103 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 ;
107107 }
108108 trapezoidsRaw += (s * s - s2 ) / 2 ;
109109 }
@@ -114,9 +114,9 @@ public int countTrapezoids(int[][] points) {
114114 }
115115 long s = 0 ;
116116 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 ;
120120 }
121121 parallelograms += (s * s - s2 ) / 2 ;
122122 }
You can’t perform that action at this time.
0 commit comments