Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这题简直就是..............当初不理解题意,搞不懂,后来看到nr们解释,恍然大悟 就是问确定一个数n,无论哪种情况翻n次都满足正面或反面全部向上,但不能小于2次 所以如果是偶数个硬币的话就要无解xxxo 如果是偶数就是n-1 知道题意后我很无语 #include <iostream> using namespace std; int main() { int n; while(cin>>n&&n) { if(n%2==0) { cout<<"No Solution!"<<endl; continue;} else cout<<n-1<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator