1

I love Zaoly!!! — Tutorial (Chinese)

 1 year ago
source link: https://codeforces.com/blog/entry/115360
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

原题链接:Zaoly Contest - A - I love Zaoly!!!

这是一道简单题。大意就是:

  • 读入整数 $$$T$$$ 。
  • 连续 $$$T$$$ 次读入整数 $$$n$$$ 。
  • 每读入一个整数 $$$n$$$ ,先输出 I love Zaoly,再循环 $$$n$$$ 次输出半角感叹号 !。最后输出一个换行符。

注意 I love Zaoly 和感叹号之间不要有空格。

注意输出完每组测试后要加一个换行符,否则输出内容全在一行了。

以下是 C++ 代码:

#include <iostream>

using namespace std;

int main()
{
    int t = 0;
    cin >> t;
    while (t > 0)
    {
        int n = 0;
        cin >> n;
        cout << "I love Zaoly";
        while (n > 0)
        {
            cout.put('!');
            --n;
        }
        cout.put('\n');
        --t;
    }
    return 0;
}

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK