竹園論壇

標題: a293 - A 百年國慶 [打印本頁]

作者: Sylveon    時間: 2014-4-26 21:08
標題: a293 - A 百年國慶
原文:http://zerojudge.tw/ShowProblem?problemid=a293
AC   :http://zerojudge.tw/Submissions?problemid=a293&account=lfs92002
ACCODE:http://ideone.com/DOMrSQ
懷舊系列,國中時寫的code。這題就暴力模擬就OK了,沒什麼大不了的,除非不會二維陣列

#include<iostream>
  • using namespace std;
  • int main()
  • {
  •         int b[5][5],a[5][5];
  •         int T,_x,x,y,sum;

  •         cin>>T;
  •         for(y=0;y<5;y++)
  •                 for(x=0;x<5;x++)
  •                         cin>>a[y][x];

  •         for(_x=0;_x<T-1;_x++)
  •         {
  •                 for(y=0;y<5;y++)
  •                         for(x=0;x<5;x++)
  •                                 cin>>b[y][x];//c.4
  •                 sum=0;
  •                 for(y=0;y<5;y++)
  •                         for(x=0;x<5;x++)
  •                         {
  •                                 if(a[y][x]==8&&b[y][x]==8)
  •                                         sum+=5;
  •                                 else if(a[y][x]==1&&b[y][x]==1)
  •                                         sum+=1;
  •                                 else if(a[y][x]==8&&b[y][x]==1)
  •                                         sum+=2;
  •                                 else
  •                                         sum+=7;


  •                         }
  •                         cout<<sum<<endl;
  •                         for(y=0;y<5;y++)
  •                                 for(x=0;x<5;x++)
  •                                         a[y][x]=b[y][x];
  •         }


  •         return 0;
  • }








  • 歡迎光臨 竹園論壇 (http://forum.tfcis.org/) Powered by Discuz! X3.2