out_of_theblue10

Maxsubseq- obs

May 15th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <fstream>
  2. #include <iostream>
  3. using namespace std;
  4. int i,x,n;
  5. int main()
  6. {
  7.   ifstream fi("max.in");
  8.   ofstream fo("max.out");
  9.   cin>>n;
  10.   for(i=1;i<=n;i++)
  11.   {
  12.     if(i%2) x=-1; else x=1;
  13.     x*=(((i-1)%3)+1);
  14.     fo<<x<<" ";
  15.   }
  16.   return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment