#8022: WA求解!!!


s3a017088 (KNBenson)

學校 : 國立勤益科技大學
編號 : 33787
來源 : [140.128.72.6]
最後登入時間 :
2013-08-03 23:00:59
a005. Eva 的回家作業 -- POJ | From: [118.170.197.197] | 發表日期 : 2013-07-30 19:36

WA (line:2)
答案不正確
您的答案為: 1 2 4 8 -107751 ...略 正確答案為: 1 2 4 8 16 
 #include <iostream>  using namespace std;   int main() {    int a1,a2,a3,a4,b1,b2,b3,b4;   int series[5];   float D;  while(cin >> D >> b1 >> b2 >> b3 >> b4 >> a1 >> a2 >> a3 >> a4){            series[b1-1] = a1;           series[b2-1] = a2;           series[b3-1] = a3;           series[b4-1] = a4;           if (series[1] - series[0] == D & series[2] - series[1] == D & series[3] - series[2] == D){              series[4] = series[3] + D;           }           else if (series[1] / series[0] == D & series[2] / series[1] == D & series[3] / series[2] == D){                series[4] = series[3] * D;           }           for (int i = 0; i < 5; i++)               cout << i+1 << " " ;           cout << endl;           for (int i = 0; i < 5; i++)               cout << series[i] << " ";           cout << endl;  }   return 0;   }
 

 
#8023: Re:WA求解!!!


s3a017088 (KNBenson)

學校 : 國立勤益科技大學
編號 : 33787
來源 : [140.128.72.6]
最後登入時間 :
2013-08-03 23:00:59
a005. Eva 的回家作業 -- POJ | From: [118.170.197.197] | 發表日期 : 2013-07-30 19:53

WA (line:2)
答案不正確
您的答案為: 1 2 4 8 -107751 ...略 正確答案為: 1 2 4 8 16 
 #include   using namespace std;   
int main() {    
int a1,a2,a3,a4,b1,b2,b3,b4;   
int series[5];   
float D;  
while(cin >> D >> b1 >> b2 >> b3 >> b4 >> a1 >> a2 >> a3 >> a4){            
	   series[b1-1] = a1;
           series[b2-1] = a2;
	   series[b3-1] = a3;
           series[b4-1] = a4;
           if (series[1] - series[0] == D & series[2] - series[1] == D & series[3] - series[2] == D){
              series[4] = series[3] + D;
           }
            else if (series[1] / series[0] == D & series[2] / series[1] == D & series[3] / series[2] == D){
                series[4] = series[3] * D;
           }
           for (int i = 0; i < 5; i++)
               cout << i+1 << " " ;
           cout << endl;
           for (int i = 0; i < 5; i++)
               cout << series[i] << " ";
           cout << endl;
  }
   return 0;   }
}           



 
ZeroJudge Forum