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 |
为什么会WA!!?哪位大佬能给一些测试数据么?#include <iostream> #include <math.h> using namespace std ; int main() { int n = 4 ; cin>>n ; int a[n] ; int b[n] ; for (int i = 0; i < n; i++) { cin >>a[i] ; b[i] = 0 ; } int sum = 0 ; for (int i = n-1; i >=0; i--) { if (a[i] != b[i]) { if (i != 0){ b[i] = 1 - b[i] ; b[i-1] = 1 - b[i-1] ; } sum = sum + pow(2 , i) ; } } cout<<sum ; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator