We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb29e88 commit 9bf0a52Copy full SHA for 9bf0a52
khj20006/202503/21 BOJ G4 Jigsaw of Shadows.md
@@ -0,0 +1,31 @@
1
+```cpp
2
+
3
+#include <bits/stdc++.h>
4
+using namespace std;
5
6
+using ld = long double;
7
8
+int main(){
9
+ cin.tie(0)->sync_with_stdio(0);
10
11
+ int theta, N;
12
+ cin>>theta>>N;
13
+ vector<pair<int,int>> A(N);
14
+ for(auto &[x,h]:A) cin>>x>>h;
15
+ sort(A.begin(), A.end());
16
17
+ ld t = tan(M_PI * theta / 180.);
18
+ ld ans = 0, last = -1;
19
+ for(int i=0;i<N;i++){
20
+ int x = A[i].first, h = A[i].second;
21
+ ld pos = (ld)h / t;
22
+ if(last > pos+x) continue;
23
+ if(last > x) ans += pos+x-last;
24
+ else ans += pos;
25
+ last = pos+x;
26
+ }
27
+ cout<<ans;
28
29
+}
30
31
+```
0 commit comments