fork download
  1. #include<bits/stdc++.h>
  2. #include <cmath>
  3. #define ll long long
  4. #define pb push_back //v.pb();
  5. #define fr(a,b) for(int i = a; i < b; i++)//for normal
  6. #define frl(a,b) for(long long i = a; i < b; i++)//for normal long long
  7. #define repi(i,a,b) for(int i = a; i < b; i++) //for cambiando el iterador
  8. #define repl(i,a,b) for(long long i = a; i < b; i++) //for cambiando el iterador
  9. #define mod 1000000007// nose
  10. #define inf (1LL<<60) // un numero muy grande
  11. #define all(x) (x).begin(), (x).end() //solo reduce el typeo xd
  12. #define aprDouble(x) cout << fixed << setprecision(13) << x //redondea con la cantidad de digitos que quieras
  13. #define triplet pair<ll,pair<ll,ll>> //pares organizamos, par(ll, par(ll, ll))
  14. #define goog(ktnio) cout << "Case #" << tno <<": " //imprime "Case#i : x"
  15. #define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)//mas rapido cin y cout
  16. #define readi(x) int x; cin >> x
  17. #define readl(x) long long x; cin >> x
  18. #define reads(x) string x; cin >> x
  19. #define readd(x) double x; cin >> x
  20. #define papucasos(x) long long x; cin >> x; while(x--)
  21. #define papu(x) cout<<x<<"\n"
  22. #define mamu(x) cout<<x
  23. #define papusalto(x) cout<<x<<" "
  24. #define readlin(input) string input;getline(cin, input)
  25. #define vl vector<ll>
  26. #define vs vector<string>
  27. #define vc vector<char>
  28. #define M_PI 3.14159265358979323846
  29. #define print(v) for(auto x : v){papusalto(x);}
  30. #define pares(v) for(auto x : v){papu(x.first<<" "<<x.second);}
  31. using namespace std;
  32.  
  33. ll power(ll k, ll x) {
  34. ll result = 1;
  35. ll base = k;
  36. while (x > 0) {
  37. if (x & 1) {
  38. result *= base;
  39. }
  40. base *= base;
  41. x >>= 1;
  42. }
  43.  
  44. return result;
  45. }
  46. void init_code(){
  47. fast_io;
  48. #ifndef ONLINE_JUDGE
  49. freopen("in.txt", "r", stdin);
  50. freopen("out.txt", "w", stdout);
  51. #endif
  52. }
  53. int main() {
  54. init_code();
  55. readd(a);readd(b);
  56. vector<pair<double,double>> v;
  57. std::vector<double> vp(300001,-1);
  58. repl(i,0,b){
  59. readd(p);readd(q);
  60. v.pb({p,q});
  61. vp[p]=q;
  62. }
  63. std::vector<double> v1;
  64. repl(i,0,300001){
  65. if(vp[i]!=-1)v1.pb((vp[i]/tan(a*(M_PI / 180.0))));
  66. }
  67. double s=0;double f=0;double px=0;double xd=1;
  68. repl(i,0,300001){
  69. if(vp[i]!=double(-1) and f!=0){
  70. s+=min(i-px,v1[xd]);
  71. xd++;
  72. }
  73. if(vp[i]!=-1){f++;px=i;}
  74. }
  75. s+=v1[v1.size()-1];
  76. aprDouble(s);
  77. return 0;
  78. }
Success #stdin #stdout 0.01s 5500KB
stdin
Standard input is empty
stdout
57.2957705347832