Remainder Problem(分块) Educational Codeforces Round 71 (Rated for Div. 2)
2024-09-05 09:07:26
引用:https://blog.csdn.net/qq_41879343/article/details/100565031
下面代码写错了,注意要上面这种。查:2 800 0,下面代码就错了。
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#include <cstdio>//sprintf islower isupper
#include <cstdlib>//malloc exit strcat itoa system("cls")
#include <iostream>//pair
#include <fstream>//freopen("C:\\Users\\13606\\Desktop\\草稿.txt","r",stdin);
#include <bitset>
//#include <map>
//#include<unordered_map>
#include <vector>
#include <stack>
#include <set>
#include <string.h>//strstr substr
#include <string>
#include <time.h>//srand(((unsigned)time(NULL))); Seed n=rand()%10 - 0~9;
#include <cmath>
#include <deque>
#include <queue>//priority_queue<int, vector<int>, greater<int> > q;//less
#include <vector>//emplace_back
//#include <math.h>
//#include <windows.h>//reverse(a,a+len);// ~ ! ~ ! floor
#include <algorithm>//sort + unique : sz=unique(b+1,b+n+1)-(b+1);+nth_element(first, nth, last, compare)
using namespace std;//next_permutation(a+1,a+1+n);//prev_permutation
#define fo(a,b,c) for(register int a=b;a<=c;++a)
#define fr(a,b,c) for(register int a=b;a>=c;--a)
#define mem(a,b) memset(a,b,sizeof(a))
#define pr printf
#define sc scanf
#define ls rt<<1
#define rs rt<<1|1
typedef long long ll;
void swapp(int &a,int &b);
double fabss(double a);
int maxx(int a,int b);
int minn(int a,int b);
int Del_bit_1(int n);
int lowbit(int n);
int abss(int a);
//const long long INF=(1LL<<60);
const double E=2.718281828;
const double PI=acos(-1.0);
const int inf=(<<);
const double ESP=1e-;
const int mod=(int)1e9+;
const int N=(int)1e6+; ll a[N];
ll ans[][]; int main()
{
int n;
sc("%d",&n);
fo(n_,,n)
{
int judge,x,y;
sc("%d%d%d",&judge,&x,&y);
if(judge==)
{
a[x]+=y;
for(int i=;i<=;++i)
ans[x%i][i]+=y;
}
else
{
ll Ans=;
if(x<=)
Ans+=ans[y][x];
else
for(int i=;i<=;i+=x)
Ans+=a[i+y-];
pr("%lld\n",Ans);
}
}
return ;
} /**************************************************************************************/ int maxx(int a,int b)
{
return a>b?a:b;
} void swapp(int &a,int &b)
{
a^=b^=a^=b;
} int lowbit(int n)
{
return n&(-n);
} int Del_bit_1(int n)
{
return n&(n-);
} int abss(int a)
{
return a>?a:-a;
} double fabss(double a)
{
return a>?a:-a;
} int minn(int a,int b)
{
return a<b?a:b;
}
最新文章
- asp.net 对数据库表增加,删除,编辑更新修改
- C#将科大讯飞语音合成文件转换为MULAW音频格式
- JavaScript SetInterval与setTimeout使用方法详解
- Python-层次聚类-Hierarchical clustering
- A Simple MVVM Example[Forward]
- javascript 如何访问 action或者controller 传给 jsp 页面的值
- ios 适应屏幕
- windows笔记-一个简单的windows GUI应用程序
- c++中构造函数 、析构函数的作用域详解
- 文件系统:介绍一个高大上的东西 - 零基础入门学习Python030
- Hibernate JPA中@Transient、@JsonIgnoreProperties、@JsonIgnore、@JsonFormat、@JsonSerialize等注解解释
- mysq Point类型 查询和插入操作:insert和select
- SpringMVC传参
- Confluence 6 代理和 HTTPS 详细配置指南链接
- JRebel 代理激活
- 最课程阶段大作业之01:使用SVN实现版本控制
- 20170712 SQL Server 日志文件收索
- 日期在Linux与Windows下的区别
- iOSUIWebView---快停下啦,你的愚蠢的行为
- 了解innodb_support_xa(分布式事务)
热门文章
- Java的消息机制
- ETL测试场景和测试用例设计
- 【java设计模式】-05建造者模式
- 【APUE】第3章 文件I/O (2) 函数creat、lseek、read、write使用说明
- java.util.Date和java.sql.Date的区别和相互转化 (转)
- Android input输入框 移动页面input手机键盘中的“搜索”按键
- Qt之CMake和MinGW编译OpenCV
- P1439 【模板】最长公共子序列 LCS
- 1.ibatis核心类
- 小D课堂 - 新版本微服务springcloud+Docker教程_5-01分布式核心知识之熔断、降级