# CSDN周赛 38期

3 篇文章 1 订阅

#### 代写匿名信

#include <iostream>
#include <string>
using namespace std;
int st[1000000];
int main()
{
string s, t;
getline(cin, s);
cin >> t;
int n = t.size();
int m = s.size();
for (int i = 0; i < n; i++)
{
int flag = 0;
for (int j = 0; j < m; j++)
{
if (st[j] == 0 && s[j] == t[i])
{
st[j] = 1;
flag = 1;
break;
}
}
if (flag == 0)
return cout << "No", 0;
}
cout << "Yes";
return 0;
}



#### 寻因找祖 ！！！ 好题 ！！！

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <cmath>
using namespace std;
long long a[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59};
long long solve(long long n, long long idx)
{
if (n == 1)
return 1;
long long ans = pow(a[idx], n - 1);
for (long long i = 2; i < n; i++)
if (n % i == 0)
ans = min(ans, pow(a[idx], i - 1) * solve(n / i, idx + 1));
return ans;
}
int main()
{
int n;
std::cin >> n;
cout << solve(n, 0);
return 0;
}



#### 小Q新式棋盘

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
int a[2000][2000];
int suma[3000], sumb[3000];
int main()
{
int n;
std::cin >> n;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
cin >> a[i][j];
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
{
suma[i] += a[i][j];
sumb[j] += a[i][j];
}
int ans = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
{
if (suma[i] < sumb[j])
ans++;
}
std::cout << ans << std::endl;

return 0;
}



#### 拯救公主

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;

int main()
{
int T;
std::cin >> T;
for (size_t i = 0; i < T; i++)
{
int m;
int x;
int y;
std::cin >> m;
std::cin >> x;
std::cin >> y;
int a, b, d;
for (int i = 0; i < m; i++)
{
char c;
cin >> c;
if (c == '*')
a = i;
}
for (int i = 0; i < m + 1; i++)
{
char c;
cin >> c;

if (c == '*')
b = i;
}
for (int i = 0; i < m + 2; i++)
{
char c;
cin >> c;
if (c == '*')
d = i;
}
int p = y % (m + x - 1);
if ((x == 1 && p == a + 1) || (x == 2 && p == b + 1) || (x == 3 && p == d + 1))
{
cout << "NO\n";
continue;
}

int flag = 1;
for (int i = 1; i < y; i++)
{
if (i % m == a && i % (m + 1) == b && i % (m + 2) == d)
{
flag = 0;
break;
}
if (i % m == 0 && i % (m + 1) == 0 && i % (m + 2) == 0)
{
break;
}
}
if (flag)
cout << "YES\n";
else
cout << "NO\n";
}
return 0;
}


• 2
点赞
• 2
收藏
觉得还不错? 一键收藏
• 1
评论
03-21 517
03-16 929
11-01 239
10-31 928
11-01 1187
06-22 467
05-25 1081
03-30 385
07-20 396
08-04 243
08-06 211
08-04 253

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、付费专栏及课程。