SGU113

定义一个数x是nearly prime当且仅当x由两个素数相乘得到,给定n个数,判断他们是不是nearly prime


傻×题

其实可以不用筛的,我脑残一下筛了素数

//Lib
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<ctime>

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
using namespace std;
//Macro
#define rep(i,a,b) for(int i=a,tt=b;i<=tt;++i)
#define rrep(i,a,b) for(int i=a,tt=b;i>=tt;--i)
#define erep(i,e,x) for(int i=x;i;i=e[i].next)
#define irep(i,x) for(__typedef(x.begin()) i=x.begin();i!=x.end();i++)
#define read() (strtol(ipos,&ipos,10))
#define sqr(x) ((x)*(x))
#define pb push_back
#define PS system("pause");
typedef long long ll;
typedef pair<int,int> pii;
const int oo=~0U>>1;
const double inf=1e20;
const double eps=1e-6;
string name="",in=".in",out=".out";
//Var
const int maxn=40000;
int vis[40008],p[10008],cnt,T,n;
void Pre()
{
	rep(i,2,maxn)
	{
		if(!vis[i])p[++cnt]=i;
		for(int j=1;j<=cnt&&i*p[j]<=maxn;j++)
		{
			vis[i*p[j]]=p[j];
			if(i%p[j]==0)break;
		}
	}
}
bool isPrime(int n)
{
	if(n<2)return false;
	rep(i,2,sqrt((double)n))
	{
		if(n%i==0)return false;
	}
	return true;
}
void Work()
{
	scanf("%d",&T);bool f;
	rep(i,1,T)
	{
		scanf("%d",&n);f=false;
		rep(i,1,cnt)
		{
			if(n%p[i]==0)
			{
				if(isPrime(n/p[i]))f=true;
				break;
			}
		}
		cout<<(f?"Yes":"No")<<endl;
	}
}
int main()
{
//	freopen((name+in).c_str(),"r",stdin);
//	freopen((name+out).c_str(),"w",stdout);
//	Init();
	Pre();
	Work();
	return 0;
}


根据我提供的信息,优化程序 待写入的topic是三个分区; 生产者线程调整为4; {"log_type":"auth","cnmaster":"764991563","last_domain":"tlbbgl-activity.changyou.com","phone":"0FDD7A79D10EE13430AFDF","media_type":"{\"base_url\":\"https://tlbbgl.changyou.com/\"}","ip":"182.135.97.61","product_id":"90","time":"2025-07-09 15:54:42","cn":"qstl0709@changyou.com","type":"oldAccount","current_domain":"auth.changyou.com","mac_new":"0"} {"log_type":"auth","cnmaster":"zjhy107@changyou.com","last_domain":"tlbbglact.changyou.com","phone":"0FD07A73D003E43236A7DE","media_type":"{\"rcc_id\":\"788920c8-61cb-4d27-a228-5c1d31fe5862\",\"type\":\"xdlb3\",\"sid\":\"52746\",\"sign\":\"A8AACB481CA753C80215182224ECF006\",\"base_url\":\"https://tlbbglact.changyou.com/tlbbgl/rlr/20250507/m/index17.shtml\"}","ip":"183.199.230.1","product_id":"90","time":"2025-07-09 15:54:46","cn":"zjhy107@changyou.com","type":"oldAccount","current_domain":"auth.changyou.com","mac_new":"0"} {"log_type":"auth","cnmaster":"602132693","last_domain":"tlbbgl-activity.changyou.com","phone":"0FDD7B79D00AE13631A2DD","media_type":"{\"base_url\":\"https://tlbbgl.changyou.com/m/index.shtml\",\"rcc_id\":\"01b8800c-74e7-4303-90b8-98e414783c66\",\"type\":\"gfgzh1\"}","ip":"218.56.20.246","product_id":"90","time":"2025-07-09 15:54:49","cn":"237176761@qq.com","type":"oldAccount","current_domain":"auth.changyou.com","mac_new":"0"} {"log_type":"auth","cnmaster":"764991582","last_domain":"tlbbglact.changyou.com","phone":"0FDC7672D00FE73736A6DD","media_type":"{\"rcc_id\":\"f9b1f1cf-bc85-40cb-b4e4-5fe2997ff177\",\"type\":\"xdlb14\",\"sid\":\"27597\",\"sign\":\"D76F6FA0C3CFCB6598E7EC9E5B71EA8A\",\"base_url\":\"https://tlbbglact.changyou.com/tlbbgl/rlr/20250507/m/index37.shtml\"}","ip":"117.136.8.228","product_id":"90","time":"2025-07-09 15:54:52","cn":"0FDC7672D00FE73736A6DD","type":"newAccount","current_domain":"auth.changyou.com","mac_new":"0"} {"log_type":"auth","cnmaster":"574596646","last_domain":"tlbbgl-activity.changyou.com","phone":"0FD27471D50EE03432A3D9","media_type":"{\"base_url\":\"https://tlbbgl.changyou.com/load/20250523/index.shtml\",\"rcc_id\":\"949acafa-1833-44f3-b899-03f250dd8f78\",\"media\":\"bd\",\"type\":\"bdsemob1\",\"bd_vid\":\"8536153497538321445\"}","ip":"58.240.95.36","product_id":"90","time":"2025-07-09 15:54:55","cn":"0FD27471D50EE03432A3D9","type":"oldAccount","current_domain":"auth.changyou.com","mac_new":"0"} {"log_type":"auth","cnmaster":"715406543","last_domain":"tlbbglact.changyou.com","phone":"0FD37471D70DE63736A3DE","media_type":"{\"rcc_id\":\"f9b1f1cf-bc85-40cb-b4e4-5fe2997ff177\",\"type\":\"xdlb14\",\"base_url\":\"https://tlbbglact.changyou.com/tlbbgl/rlr/20250507/m/index03.shtml\"}","ip":"1.197.240.150","product_id":"90","time":"2025-07-09 15:54:56","cn":"bs0410@changyou.com","type":"oldAccount","current_domain":"auth.changyou.com","mac_new":"0"} {"log_type":"auth","cnmaster":"731641905","last_domain":"tlbbgl-activity.changyou.com","phone":"0FDD7671D70CE1313BAFD3","media_type":"{\"base_url\":\"https://tlbbgl.changyou.com/load/20250701/m/index.shtml\",\"kscallback\":\"KvI4N-snDnO5j90vY8WBWi_MNuOQ-XKA_VvjczWc1dlkR-a74F8a2tIC54j2hp8Ch8qNSLaziB60yCCOVEDqfW32CyxNYQ1_ZSJM4L6dtu5l3Hxn0JNf_r9UdFAkpygreSicn-aXuiytn01k8sgU8GKrhYT6rdt9j8YWDFnWARzpEieYEJrRjaViX6xajd1B7gch_dog2Cj9xoICAdyfxTuK20AP6d2BWAbO3Iu7kqFbGfGHR-yPk-gIcwMOERFp\",\"rcc_id\":\"d6e4cad6-357a-418d-94cb-2105288bd6e4\",\"media\":\"ks\",\"type\":\"tfby3\"}","ip":"112.65.27.242","product_id":"90","time":"2025-07-09 15:54:57","cn":"0FDD7671D70CE1313BAFD3","type":"oldAccount","current_domain":"auth.changyou.com","mac_new":"0"} {"log_type":"auth","cnmaster":"758218289","last_domain":"tlbbgl-activity.changyou.com","phone":"0FDD7170D702EB3937A7D9","media_type":"{\"rcc_id\":\"1c817f78-f113-499c-be6f-de523b199a2b\",\"wx_aid\":\"43651481675\",\"base_url\":\"https://tlbbgl.changyou.com/load/20250523/m/index.shtml\",\"wx_traceid\":\"wx0b2fzf6bw6kg5o01\",\"media\":\"gdt\",\"type\":\"gdtob2\",\"tid\":\"43651555625\",\"gdt_vid\":\"wx0b2fzf6bw6kg5o01\"}","ip":"183.224.110.1","product_id":"90","time":"2025-07-09 15:54:58","cn":"0FDD7170D702EB3937A7D9","type":"oldAccount","current_domain":"auth.changyou.com","mac_new":"0"} 这几种格式的json随机发送,内容做替换
最新发布
07-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值