史上最惨的惨剧,07高精度板子挂了,09忘记了说狼人是村名的人一定是狼人(
01 BPM136
1 /* *********************************************** 2 Author :BPM136 3 Created Time :2018/8/8 12:11:34 4 File Name :1001.cpp 5 ************************************************ */ 6 7 #include<iostream> 8 #include<cstdio> 9 #include<algorithm> 10 #include<cstdlib> 11 #include<cmath> 12 #include<cstring> 13 #include<vector> 14 using namespace std; 15 16 const long double pi = acos(-1.0); 17 18 int main() { 19 int T; 20 scanf("%d",&T); 21 while(T--) { 22 int a,b; 23 scanf("%d%d",&a,&b); 24 long long ans=double( pi*a+(long double)2.0*b ) * 1000000; 25 printf("%.6f ",ans/1000000.0); 26 } 27 return 0; 28 }
09 BPM136
1 /* *********************************************** 2 Author :BPM136 3 Created Time :2018/8/8 16:19:14 4 File Name :1009.cpp 5 ************************************************ */ 6 7 #include<iostream> 8 #include<cstdio> 9 #include<algorithm> 10 #include<cstdlib> 11 #include<cmath> 12 #include<cstring> 13 #include<iomanip> 14 #include<bitset> 15 #include<queue> 16 #include<ctime> 17 #include<set> 18 #include<map> 19 #include<vector> 20 #include<cassert> 21 #include<functional> 22 #define pb push_back 23 #define popb pop_back 24 #define MID ((l+r)>>1) 25 #define LSON (k<<1) 26 #define RSON (k<<1|1) 27 #define get(a,i) ((a)&(1<<(i-1))) 28 #define PAU putchar(32) 29 #define ENT putchar(10) 30 #define clr(a,b) memset(a,b,sizeof(a)) 31 #define rep(_i,_a,_b) for(int _i=(_a);_i<=(_b);_i++) 32 #define down(_i,_a,_b) for(int _i=(_a);_i>=(_b);_i--) 33 #define FOR(_i,_b) for(int _i=1;_i<=(_b);_i++) 34 #define efo(_i,_a) for(int _i=last[(_a)];_i!=0;_i=e[_i].next) 35 #define Remax(a,b) if(b>a) a=b; 36 #define Remin(a,b) if(b<a) a=b; 37 #define SZ(x) ((int)(x).size()) 38 #define filein(x) freopen(#x".in","r",stdin) 39 #define fileout(x) freopen(#x".out","w",stdout) 40 #define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout); 41 #define mkd(x) freopen(#x".in","w",stdout); 42 #define setlargestack(x) int _SIZE=x<<20;char *_PPP=(char*)malloc(_SIZE)+_SIZE;__asm__("movl %0, %%esp " :: "r"(_PPP)); 43 #define END system("pause") 44 #define read2(a,b) read(a),read(b) 45 #define read3(a,b,c) read(a),read(b),read(c) 46 #define readg(_x1,_y1,_x2,_y2) read(_x1),read(_y1),read(_x2),read(_y2) 47 using namespace std; 48 49 typedef long long ll; 50 typedef double DB; 51 typedef long double LD; 52 typedef unsigned int UI; 53 typedef unsigned long long ULL; 54 typedef vector<int> VI; 55 typedef set<int> SI; 56 typedef set<int , greater<int> > SIG; 57 typedef map<int, int > MII; 58 typedef map<int, int, greater<int> > MIIG; 59 60 namespace fastIO{ 61 #define BUF_SIZE 100000 62 #define OUT_SIZE 100000 63 //fread->read 64 bool IOerror=0; 65 inline char nc(){ 66 static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE; 67 if (p1==pend){ 68 p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin); 69 if (pend==p1){IOerror=1;return -1;} 70 //{printf("IO error! ");system("pause");for (;;);exit(0);} 71 } 72 return *p1++; 73 } 74 inline bool blank(char ch){return ch==32||ch==10||ch==13||ch==9;} 75 inline bool enter(char ch){return ch==10||ch==13;} 76 inline void read(int &x){ 77 bool sign=0; char ch=nc(); x=0; 78 for (;blank(ch);ch=nc()); 79 if (IOerror)return; 80 if (ch==45)sign=1,ch=nc(); 81 for (;ch>=48&&ch<=57;ch=nc())x=x*10+ch-48; 82 if (sign)x=-x; 83 } 84 inline void read(ll &x){ 85 bool sign=0; char ch=nc(); x=0; 86 for (;blank(ch);ch=nc()); 87 if (IOerror)return; 88 if (ch==45)sign=1,ch=nc(); 89 for (;ch>=48&&ch<=57;ch=nc())x=x*10+ch-48; 90 if (sign)x=-x; 91 } 92 inline void read(double &x){ 93 bool sign=0; char ch=nc(); x=0; 94 for (;blank(ch);ch=nc()); 95 if (IOerror)return; 96 if (ch==45)sign=1,ch=nc(); 97 for (;ch>=48&&ch<=57;ch=nc())x=x*10+ch-48; 98 if (ch==46){ 99 double tmp=1; ch=nc(); 100 for (;ch>=48&&ch<=57;ch=nc())tmp/=10.0,x+=tmp*(ch-48); 101 } 102 if (sign)x=-x; 103 } 104 inline void read(char *s){ 105 char ch=nc(); 106 for (;blank(ch);ch=nc()); 107 if (IOerror)return; 108 for (;!blank(ch)&&!IOerror;ch=nc())*s++=ch; 109 *s=0; 110 } 111 inline void read(char *s,bool f) { 112 char ch=nc(); 113 for (;blank(ch);ch=nc()); 114 if(IOerror)return; 115 for(;!enter(ch)&&!IOerror;ch=nc())*s++=ch; 116 *s=0; 117 } 118 inline void read(char &c){ 119 for (c=nc();blank(c);c=nc()); 120 if (IOerror){c=-1;return;} 121 } 122 #undef OUT_SIZE 123 #undef BUF_SIZE 124 }; using namespace fastIO; 125 126 const int N = 100005; 127 128 VI E[N]; 129 130 int F_f[N]; 131 bool F_c[N]; 132 133 int F_find(int x) { 134 if(F_f[x]==x) return x; 135 return F_f[x]=F_find(F_f[x]); 136 } 137 138 int fa[N],ty[N]; 139 int n; 140 141 bool v[N]; 142 143 void dfs(int x) { 144 v[x]=1; 145 for(auto v : E[x]) { 146 dfs(v); 147 } 148 } 149 150 int main() { 151 setlargestack(64); 152 freopen("in","r",stdin); 153 freopen("1.out","w",stdout); 154 int T; 155 read(T); 156 while(T--) { 157 read(n); 158 int x; 159 char op[11]; 160 for(int i=1;i<=n;i++) E[i].clear(); 161 for(int i=1;i<=n;i++) { 162 read2(x,op); 163 fa[i]=x; 164 if(op[0]=='w') ty[i]=1; else ty[i]=2; 165 } 166 for(int i=1;i<=n;i++) F_f[i]=i, F_c[i]=0; 167 168 for(int i=1;i<=n;i++) if(ty[i]==2) { 169 int x=i, y=fa[i]; 170 E[y].push_back(x); 171 int dx=F_find(x), dy=F_find(y); 172 if(dx!=dy) { 173 if(F_c[dx]==1) F_f[dy]=dx; else 174 if(F_c[dy]==1) F_f[dx]=dy; else F_f[dx]=dy; 175 } else F_c[dx]=1; 176 } 177 int ans1=0,ans2=0; 178 memset(v,0,sizeof(v)); 179 for(int i=1;i<=n;i++) if(ty[i]==1) { 180 int a=i, b=fa[i]; 181 int dx=F_find(b); 182 if(F_c[dx]) continue; 183 if(dx==a) dfs(b); 184 } 185 for(int i=1;i<=n;i++) if(v[i]) ans2++; 186 cout<<"0 "<<ans2<<endl; 187 } 188 return 0; 189 }
12 小洛洛
1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 #include <cmath> 5 #include <cstdlib> 6 #include <algorithm> 7 using namespace std; 8 9 template<int BI, int BO> 10 struct IO_ { 11 char bufi[BI + 1], *qi, bufo[BO], *qo; 12 IO_(): qi(bufi + BI), qo(bufo) {} 13 ~IO_() { o_(EOF); } 14 int i_() { 15 if(qi == bufi + BI) bufi[fread(bufi, 1, BI, stdin)] = '