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 }
  • 相关阅读:
    uni-app实现下拉效果
    求点到已知直线的距离和点到直线的垂点坐标
    Mybatis 自定义SqlSessionFactoryBean扫描通配符typeAliasesPackage
    前端string类型的日期 -后端实体类属性为Date
    如何更新npm为最新版本
    简述ThreadPoolExecutor的运行机制
    list在遍历过程中的add/remove
    Linux下安装mysql
    Linux下安装activeMQ并设置开机启动
    solr集群环境搭建
  • 原文地址:https://www.cnblogs.com/hsd-/p/5747854.html
Copyright © 2011-2022 走看看