题目链接:http://codeforces.com/problemset/problem/705/A
从第三个输出中可看出规律,
I hate that I love that I hate it
I hate
I love
是来回循环的,不到最后一个每一次循环后面都输出 that,如果到最后则输出 it
#include<bits/stdc++.h>
using namespace std;
int main()
{
char a[][]= {"I love ","I hate "};
int n;
while(~scanf("%d",&n))
{
int x=;
for(int i=; i<n; i++)
{
printf("%s",a[x]);
if(i!=(n-))
printf("that ");
x=!x;
}
printf("it\n");
} return ;
}