Don't like ads? PRO users don't see any ads ;-)
Guest

Maxsubseq- obs

By: out_of_theblue10 on May 15th, 2012  |  syntax: C++  |  size: 0.26 KB  |  hits: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }