From 1ec4527ef80dcd64942282418ba7f4c6b09d8eb0 Mon Sep 17 00:00:00 2001 From: upagyya <55059253+upagyya@users.noreply.github.com> Date: Thu, 6 Aug 2020 11:39:40 +0530 Subject: [PATCH] solution 1284A --- 1284A.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 1284A.cpp diff --git a/1284A.cpp b/1284A.cpp new file mode 100644 index 0000000..59cca94 --- /dev/null +++ b/1284A.cpp @@ -0,0 +1,33 @@ +#include +using namespace std; + +int main() +{ + int n,m; //sizes of vectors + cin>>n>>m; + vector s(n),t(m); //two vectors of string types of sizes n and m + + for(int i=0;i>s[i]; + + for(int i=0;i>t[i]; + + int q; //no. of queries + cin>>q; + + while(q--) //loop running till q queries + { + long long int y; //year + cin>>y; + + int i = (y-1)%n; //string number of vector s corresponding to given year + int j = (y-1)%m; //string number of vector t corresponding to given year + + string ans = s[i]+t[j]; //concatenation of both strings + + cout<