#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
const double eps = 1e-9 ;
double sqrDist( double x1, double y1, double x2, double y2) {
return ( x1 - x2) * ( x1 - x2) + ( y1 - y2) * ( y1 - y2) ;
}
double dist( double x1, double y1, double x2, double y2) {
return sqrt ( sqrDist( x1, y1, x2, y2) ) ;
}
const double PI = acos ( - 1.0 ) ;
int main( ) {
int x0, y0, v, t;
scanf ( "%d%d%d%d" , & x0, & y0, & v, & t) ;
double r0 = 1.0 * v * t;
int n;
scanf ( "%d" , & n) ;
vector< pair< double , int > > a;
for ( int i = 0 ; i < n; i++ ) {
int x, y, r;
scanf ( "%d%d%d" , & x, & y, & r) ;
double d = sqrDist( x, y, x0, y0) ;
if ( d < 1.0 * r * r + eps) {
printf ( "%.11f" , 1.0 ) ;
return 0 ;
}
d = sqrt ( d) ;
if ( r + r0 < d - eps) {
continue ;
}
double angL, angR, ang;
double angM = atan2 ( y - y0, x - x0) ;
if ( angM < 0 ) {
angM + = 2 * PI;
}
double tLen = sqrt ( d * d - 1.0 * r * r) ;
if ( tLen < r0 + eps) {
ang = asin ( r / d) ;
} else {
ang = acos ( ( d * d + r0 * r0 - 1.0 * r * r) / ( 2 * d * r0) ) ;
}
angL = angM - ang;
angR = angM + ang;
if ( angL < 0 ) {
a.push_back ( make_pair( angL + 2 * PI, 1 ) ) ;
a.push_back ( make_pair( 2 * PI, - 1 ) ) ;
a.push_back ( make_pair( 0.0 , 1 ) ) ;
a.push_back ( make_pair( angR, - 1 ) ) ;
} else if ( angR > 2 * PI) {
a.push_back ( make_pair( angL, 1 ) ) ;
a.push_back ( make_pair( 2 * PI, - 1 ) ) ;
a.push_back ( make_pair( 0.0 , 1 ) ) ;
a.push_back ( make_pair( angR - 2 * PI, - 1 ) ) ;
} else {
a.push_back ( make_pair( angL, 1 ) ) ;
a.push_back ( make_pair( angR, - 1 ) ) ;
}
}
sort( a.begin ( ) , a.end ( ) ) ;
double last = 0 ;
int c = 0 ;
double ans = 0 ;
for ( auto & p : a) {
if ( c > 0 ) {
ans + = p.first - last;
}
c + = p.second ;
last = p.first ;
}
ans / = 2 * PI;
printf ( "%.11f" , ans) ;
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDxhbGdvcml0aG0+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgZG91YmxlIGVwcyA9IDFlLTk7Cgpkb3VibGUgc3FyRGlzdChkb3VibGUgeDEsIGRvdWJsZSB5MSwgZG91YmxlIHgyLCBkb3VibGUgeTIpIHsKICAgIHJldHVybiAoeDEgLSB4MikgKiAoeDEgLSB4MikgKyAoeTEgLSB5MikgKiAoeTEgLSB5Mik7Cn0KCmRvdWJsZSBkaXN0KGRvdWJsZSB4MSwgZG91YmxlIHkxLCBkb3VibGUgeDIsIGRvdWJsZSB5MikgewogICAgcmV0dXJuIHNxcnQoc3FyRGlzdCh4MSwgeTEsIHgyLCB5MikpOwp9Cgpjb25zdCBkb3VibGUgUEkgPSBhY29zKC0xLjApOwoKaW50IG1haW4oKSB7CiAgICBpbnQgeDAsIHkwLCB2LCB0OwoKICAgIHNjYW5mKCIlZCVkJWQlZCIsICZ4MCwgJnkwLCAmdiwgJnQpOwoKICAgIGRvdWJsZSByMCA9IDEuMCAqIHYgKiB0OwoKICAgIGludCBuOwogICAgc2NhbmYoIiVkIiwgJm4pOwoKICAgIHZlY3RvcjxwYWlyPGRvdWJsZSwgaW50PiA+IGE7CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgICBpbnQgeCwgeSwgcjsKICAgICAgICBzY2FuZigiJWQlZCVkIiwgJngsICZ5LCAmcik7CiAgICAgICAgZG91YmxlIGQgPSBzcXJEaXN0KHgsIHksIHgwLCB5MCk7CiAgICAgICAgaWYgKGQgPCAxLjAgKiByICogciArIGVwcykgewogICAgICAgICAgICBwcmludGYoIiUuMTFmIiwgMS4wKTsKICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgfQogICAgICAgIGQgPSBzcXJ0KGQpOwogICAgICAgIGlmIChyICsgcjAgPCBkIC0gZXBzKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgIH0KCiAgICAgICAgZG91YmxlIGFuZ0wsIGFuZ1IsIGFuZzsKICAgICAgICBkb3VibGUgYW5nTSA9IGF0YW4yKHkgLSB5MCwgeCAtIHgwKTsKICAgICAgICBpZiAoYW5nTSA8IDApIHsKICAgICAgICAgICAgYW5nTSArPSAyICogUEk7CiAgICAgICAgfQoKICAgICAgICBkb3VibGUgdExlbiA9IHNxcnQoZCAqIGQgLSAxLjAgKiByICogcik7CiAgICAgICAgaWYgKHRMZW4gPCByMCArIGVwcykgewogICAgICAgICAgICBhbmcgPSBhc2luKHIgLyBkKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBhbmcgPSBhY29zKChkICogZCArIHIwICogcjAgLSAxLjAgKiByICogcikgLyAoMiAqIGQgKiByMCkpOwogICAgICAgIH0KCiAgICAgICAgYW5nTCA9IGFuZ00gLSBhbmc7CiAgICAgICAgYW5nUiA9IGFuZ00gKyBhbmc7CgogICAgICAgIGlmIChhbmdMIDwgMCkgewogICAgICAgICAgICBhLnB1c2hfYmFjayhtYWtlX3BhaXIoYW5nTCArIDIgKiBQSSwgMSkpOwogICAgICAgICAgICBhLnB1c2hfYmFjayhtYWtlX3BhaXIoMiAqIFBJLCAtMSkpOwogICAgICAgICAgICBhLnB1c2hfYmFjayhtYWtlX3BhaXIoMC4wLCAxKSk7CiAgICAgICAgICAgIGEucHVzaF9iYWNrKG1ha2VfcGFpcihhbmdSLCAtMSkpOwogICAgICAgIH0gZWxzZSBpZiAoYW5nUiA+IDIgKiBQSSkgewogICAgICAgICAgICBhLnB1c2hfYmFjayhtYWtlX3BhaXIoYW5nTCwgMSkpOwogICAgICAgICAgICBhLnB1c2hfYmFjayhtYWtlX3BhaXIoMiAqIFBJLCAtMSkpOwogICAgICAgICAgICBhLnB1c2hfYmFjayhtYWtlX3BhaXIoMC4wLCAxKSk7CiAgICAgICAgICAgIGEucHVzaF9iYWNrKG1ha2VfcGFpcihhbmdSIC0gMiAqIFBJLCAtMSkpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGEucHVzaF9iYWNrKG1ha2VfcGFpcihhbmdMLCAxKSk7CiAgICAgICAgICAgIGEucHVzaF9iYWNrKG1ha2VfcGFpcihhbmdSLCAtMSkpOwogICAgICAgIH0KICAgIH0KCiAgICBzb3J0KGEuYmVnaW4oKSwgYS5lbmQoKSk7CgogICAgZG91YmxlIGxhc3QgPSAwOwogICAgaW50IGMgPSAwOwogICAgZG91YmxlIGFucyA9IDA7CgogICAgZm9yIChhdXRvJiBwIDogYSkgewogICAgICAgIGlmIChjID4gMCkgewogICAgICAgICAgICBhbnMgKz0gcC5maXJzdCAtIGxhc3Q7CiAgICAgICAgfQogICAgICAgIGMgKz0gcC5zZWNvbmQ7CiAgICAgICAgbGFzdCA9IHAuZmlyc3Q7CiAgICB9CgogICAgYW5zIC89IDIgKiBQSTsKICAgIHByaW50ZigiJS4xMWYiLCBhbnMpOwoKICAgIHJldHVybiAwOwp9
compilation info
prog.cpp: In function 'int main()':
prog.cpp:23:39: error: 'scanf' was not declared in this scope
scanf("%d%d%d%d", &x0, &y0, &v, &t);
^
prog.cpp:37:32: error: 'printf' was not declared in this scope
printf("%.11f", 1.0);
^
prog.cpp:83:16: error: ISO C++ forbids declaration of 'p' with no type [-fpermissive]
for (auto& p : a) {
^
prog.cpp:83:20: warning: range-based 'for' loops only available with -std=c++11 or -std=gnu++11
for (auto& p : a) {
^
prog.cpp:85:22: error: request for member 'first' in 'p', which is of non-class type 'int'
ans += p.first - last;
^
prog.cpp:87:16: error: request for member 'second' in 'p', which is of non-class type 'int'
c += p.second;
^
prog.cpp:88:18: error: request for member 'first' in 'p', which is of non-class type 'int'
last = p.first;
^
prog.cpp:92:24: error: 'printf' was not declared in this scope
printf("%.11f", ans);
^
stdout