zoukankan      html  css  js  c++  java
  • Codeforces Round #366 (Div. 2) A

    A. Hulk
    time limit per test
    1 second
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.

    Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second one is love, third one is hate and so on...

    For example if n = 1, then his feeling is "I hate it" or if n = 2 it's "I hate that I love it", and if n = 3 it's "I hate that I love that I hate it" and so on.

    Please help Dr. Banner.

    Input

    The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.

    Output

    Print Dr.Banner's feeling in one line.

    Examples
    input
    1
    output
    I hate it
    input
    2
    output
    I hate that I love it
    input
    3
    output
    I hate that I love that I hate it

     题意:水题

     题解:取模输出

     1 /******************************
     2 code by drizzle
     3 blog: www.cnblogs.com/hsd-/
     4 ^ ^    ^ ^
     5  O      O
     6 ******************************/
     7 //#include<bits/stdc++.h>
     8 #include<iostream>
     9 #include<cstring>
    10 #include<cstdio>
    11 #include<map>
    12 #include<algorithm>
    13 #include<queue>
    14 #include<cmath>
    15 #define ll __int64
    16 #define PI acos(-1.0)
    17 #define mod 1000000007
    18 using namespace std;
    19 int n;
    20 int main()
    21 {
    22     scanf("%d",&n);
    23     for(int i=1;i<=n;i++)
    24     {
    25         if(i%2==1)
    26             cout<<"I hate";
    27         if(i%2==0)
    28             cout<<"I love";
    29         if(i!=n)
    30             cout<<" that ";
    31         if(i==n)
    32             cout<<" it"<<endl;
    33     }
    34     return 0;
    35 }
  • 相关阅读:
    比较两个树是否相同
    将一个字符串转换成一个整数
    求数组中第一个重复数字
    Redis之哨兵机制(sentinel)——配置详解及原理介绍
    ==和equals的区别
    求一个数的立方根
    检测应用版本
    【转】UITableViewCell自适应高度 UILabel自适应高度和自动换行
    iOS7中Cell高度 Label高度自适应
    MarsEdit 快速插入代码
  • 原文地址:https://www.cnblogs.com/hsd-/p/5747854.html
Copyright © 2011-2022 走看看