码迷,mamicode.com
首页 > 其他好文 > 详细

Hello 2020 A.New Year and Naming

时间:2020-01-05 18:56:26      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:for   uri   ons   namespace   def   str   its   ret   space   

题目:https://codeforces.com/contest/1284/problem/A
思路:输出 \(s[(y-1)\%n]+t[(y-1)\%m]\) 即可

#include<bits/stdc++.h>
 
using namespace std;
 
const int N=22;
 
int n,m;
string s[N],t[N];
int q;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    //freopen("in.txt","r",stdin);
    cin>>n>>m;
    for(int i=0;i<n;i++) cin>>s[i];
    for(int i=0;i<m;i++) cin>>t[i];
    cin>>q;
    for(int i=1;i<=q;i++)
    {
        int x;
        cin>>x;
        x--;
        cout<<s[x%n]<<t[x%m]<<endl;
    }
    return 0;
}

Hello 2020 A.New Year and Naming

标签:for   uri   ons   namespace   def   str   its   ret   space   

原文地址:https://www.cnblogs.com/c4Lnn/p/12153094.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!