首页 > 其他分享 >小红不想做莫比乌斯反演杜教筛求因子和的前缀和(枚举)--牛客周赛 Round 39-E

小红不想做莫比乌斯反演杜教筛求因子和的前缀和(枚举)--牛客周赛 Round 39-E

时间:2024-04-08 18:03:47浏览次数:14  
标签:周赛 39 const int tt cin long 筛求 define

在这里插入图片描述

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define inf 1e18
const int mod=1e9+7;
const int N=2e5+5;
int n,m,p,x;
void solve(){
	cin>>n>>m>>p>>x;
	int ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(i*j>=x||(2*i+2*j)*p+i*j<x) continue;
			if((x-i*j)%(2*i+2*j)==0) ans++;	
		}
	}
	cout<<ans;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int tt=1;
//	cin>>tt;
	while(tt--) solve();
	return 0;
}

标签:周赛,39,const,int,tt,cin,long,筛求,define
From: https://blog.csdn.net/JungleZRD/article/details/137518309

相关文章

  • 小红不想做完全背包 (hard)(DP)--牛客周赛 Round 39-D
    #include<bits/stdc++.h>usingnamespacestd;#defineintlonglong#defineendl'\n'#defineinf1e18constintmod=1e9+7;constintN=2005;//typedef__int128lll;//typedefunsignedlonglongull;intn,p;inta[N],dp[N];voidsolve(){......
  • SpringBoot拦截器注入stringredistemplate出现Consider defining a bean of type 'org
    问题自定义拦截器需要注入StringRedisTemplate来通过token获取redis中的数据自定义拦截器代码@ComponentpublicclassLoginInterceptorimplementsHandlerInterceptor{@AutowiredprivateStringRedisTemplatestringRedisTemplate;@Overridepublicb......
  • P4139TriangleXor
    数学#计数#容斥分为\(4\)个部分计算上面的按奇偶性分类下面的按每一层容斥,即\(siz_i-2\timessiz_{i-1}+siz_{i-2}\)左右直接对每一块计算面积//Author:xiaruizeconstintINF=0x3f3f3f3f3f3f3f3f;constintMOD=1000000007;constintN=2e5+10;intn;......
  • 信息学奥赛一本通:1398:短信计费
    【题目描述】用手机发短信,一条短信资费为0.1元,但限定一条短信的内容在70个字以内(包括70个字)。如果你一次所发送的短信超过了70个字,则会按照每70个字一条短信的限制把它分割成多条短信发送。假设已经知道你当月所发送的短信的字数,试统计一下你当月短信的总资费。【输入】......
  • 牛客周赛 Round 39(小白被虐记)
    A.小红不想做炸鸡块粉丝粉丝题Code:#include<bits/stdc++.h>usingnamespacestd;intmain(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);intv,s=0;cin>>v;s+=v;for(inti=1,x;i<=4;i++){cin&......
  • 2-39. 创建 TransitionManager 控制人物场景切换
    上节课最终画好的场景BuildSettings添加场景PersistentScene添加TransitionManager记得添加命名空间注册场景切换的事件添加传送点实现传送修改EventHandler项目相关代码代码仓库:https://gitee.com/nbda1121440/farm-tutorial.git标签:20240407_1934......
  • TS2339 错误如何关闭
    TS2339错误是TypeScript编译器报告的一种类型错误,表示在某个类型上尝试访问的属性不存在。要解决或关闭TS2339错误,通常应通过以下途径之一来修正代码,使其符合类型系统的预期:正确指定类型或接口:确保你为变量、函数参数、返回值等指定了正确的类型或接口,确保这些类型或接口中确......
  • node 建立一个electron的hello world 的工程 有窗体const { app, BrowserWindow } = r
     要创建一个Electron的"HelloWorld"工程,可以按照以下步骤进行:首先,确保你已经安装了Node.js。使用命令行工具进入你要创建项目的目录。运行以下命令来初始化一个新的Node.js项目:bash|npminit-y这将创建一个默认的package.json文件。确保你......
  • LeetCode 1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows
    原题链接在这里:https://leetcode.com/problems/find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows/description/题目:Youaregivenan mxn matrix mat thathasitsrowssortedinnon-decreasingorderandaninteger k.Youareallowedtochoose exactlyo......
  • 记录一下远程链接mysql报host 'xxx.xxx.xxx' is not allowed to connect to this mysq
    问题说明:服务器上的mysql本地是可以链接3306端口的,但是远程链接服务器的3306端口报错,在排除了 服务器端口和服务器防火墙 的问题之后,确定问题应该是mysql的问题解决方式:1.点击mysql命令 2.输入数据库密码 3.输入 usemysql4.输入  updateusersethost=......