标签:pre clu roc sub 程序 运动 bit inf proc
2 10 4 7 8 3 9
0 5
解法:模拟~
1 #include<bits/stdc++.h> 2 #define clr(x) memset(x,0,sizeof(x)) 3 #define LL long long 4 using namespace std; 5 #define INF 0x3f3f3f3f 6 typedef long long ll; 7 const int N= 30 +9; 8 struct Matrix 9 { 10 int m[N][N]; 11 }; 12 int Dinit,Dend; 13 int add,sub; 14 int main() 15 { 16 int test; 17 int L,t,T; 18 cin>>test; 19 while(test--) 20 { 21 cin>>L>>t>>T; 22 Dinit=0,Dend=L; 23 add=1,sub=-1; 24 for(int i=1;i<=T;i++) 25 { 26 if(i>t){Dinit+=add,Dend+=sub;} 27 else{Dinit+=add;} 28 if(Dinit==Dend){add=-1,sub=1;} 29 if(Dinit==0){add=1;} 30 if(Dinit==L){add=-1;} 31 if(Dend==0){sub=1;} 32 if(Dend==L){sub=-1;} 33 } 34 cout<<abs(Dend-Dinit)<<endl; 35 } 36 return 0; 37 }
标签:pre clu roc sub 程序 运动 bit inf proc
原文地址:http://www.cnblogs.com/yinghualuowu/p/7857580.html