Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions khj20006/202503/21 BOJ G4 Jigsaw of Shadows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
```cpp

#include <bits/stdc++.h>
using namespace std;

using ld = long double;

int main(){
cin.tie(0)->sync_with_stdio(0);

int theta, N;
cin>>theta>>N;
vector<pair<int,int>> A(N);
for(auto &[x,h]:A) cin>>x>>h;
sort(A.begin(), A.end());

ld t = tan(M_PI * theta / 180.);
ld ans = 0, last = -1;
for(int i=0;i<N;i++){
int x = A[i].first, h = A[i].second;
ld pos = (ld)h / t;
if(last > pos+x) continue;
if(last > x) ans += pos+x-last;
else ans += pos;
last = pos+x;
}
cout<<ans;

}

```