首页 > 小红的“质数”寻找
头像 糖串
发表于 2025-03-19 14:51:43
#include <iostream> #include <map> #include <vector> using namespace std; string fun(char first) { int n = first - '0'; if 展开全文
头像 黑榜o小兔
发表于 2025-04-30 15:14:05
题目描述是找到 [x, 2x] 范围内 满足所有数位和 为质数,X数据大到10w位,直接查肯定不行需要转换一下思路,因为要求只要1个结果,自己构造肯定是怎么方便怎么来所以只需要考虑答案的前1~2位,后面全部补0,这样就是最简单的办法现在来确定一下范围就行,当X = 1.ddd × 10n ,[ x 展开全文
头像 Lunaurara
发表于 2025-11-24 17:51:05
nums = ["2", "3", "5", "5", "7", "7", "12", "12", "12"] t = 展开全文
头像 Goldminer
发表于 2025-04-28 10:44:14
#include <iostream> // 输入输出流 #include <string> // 字符串处理 #include <vector> // 动态数组 vector #include <algorithm&g 展开全文
头像 lotusor
发表于 2026-05-20 00:51:45
观察数字范围的分布可以得出,只需枚举数位和为质数的最小代表数(2,3,5,7,11),并通过不断乘 10 将其映射至 [x,2x]区间内,即可保证构造合法 t = int(input()) ans = [2,3,5,7,11] for _ in range(t): x = int(input 展开全文
头像 BeauWill
发表于 2026-05-20 00:53:33
Modern Cpp #include <iostream> #include <string> void solve(){ std::string x; std::cin >> x; auto get = [&](int c){ 展开全文
头像 Starlight_Footprint
发表于 2026-05-20 08:38:18
#include <bits/stdc++.h> #define ll long long #define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; const int d[]={-1 展开全文
头像 番禺小韭菜
发表于 2025-03-06 10:29:16
#include <iostream> #include <vector> using namespace std; vector<string> ans = {"2", "3", "5", " 展开全文
头像 irelia1
发表于 2025-04-09 00:10:35
#include <iostream> using namespace std; int main() { int t; cin>>t; string res; while(cin>>res){ if(res[0] 展开全文
头像 CARLJOSEPHLEE
发表于 2025-03-02 12:22:34
from sys import stdin,stdout input = lambda:stdin.readline().strip() for _ in range(int(input())): x = input() len1 = len(x)-1 s = int(x[0 展开全文

等你来战

查看全部