2023/1/13
[ABC284A] Sequence of Strings
https://www.luogu.com.cn/problem/AT_abc284_a
不愧是ABC的A题,依题意模拟即可。
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
string s[15];
cin>>n;
for(int i=1;i<=n;i++) cin>>s[i];
for(int i=n;i>=1;i--) cout<<s[i]<<endl;
return 0;
}
[ABC284B] Multi Test Cases
https://www.luogu.com.cn/problem/AT_abc284_b
这次B题怎么这么简单......
#include<bits/stdc++.h>
using namespace std;
int t;
int main()
{
cin>>t;
while(t--)
{
int n,ans=0;
cin>>n;
for(int i=1;i<=n;i++)
{
int a;
cin>>a;
if(a%2) ans++;
}
cout<<ans<<endl;
}
return 0;
}
B3619 10 进制转 x 进制
https://www.luogu.com.cn/problem/B3619
大模板。
#include<bits/stdc++.h>
using namespace std;
int n,b;
string str;
string hexb(int dec,int b)
{
str.clear();
while(dec>0)
{
if(dec%b<10)
str=char('0'+dec%b)+str;
else
str=char('A'+dec%b-10)+str;
dec/=b;
}
return str;
}
int main()
{
cin>>n>>b;
cout<<hexb(n,b);
return 0;
}
标签:www,cn,记录,int,namespace,https,2023,string
From: https://www.cnblogs.com/zhujiangyuan/p/2023-1_1.html