zoukankan      html  css  js  c++  java
  • Remainder Problem(分块) Educational Codeforces Round 71 (Rated for Div. 2)

    引用:https://blog.csdn.net/qq_41879343/article/details/100565031

    下面代码写错了,注意要上面这种。查:2  800  0,下面代码就错了。

      1 #define IOS ios_base::sync_with_stdio(0); cin.tie(0);
      2 #include <cstdio>//sprintf islower isupper
      3 #include <cstdlib>//malloc  exit strcat itoa system("cls")
      4 #include <iostream>//pair
      5 #include <fstream>//freopen("C:\Users\13606\Desktop\草稿.txt","r",stdin);
      6 #include <bitset>
      7 //#include <map>
      8 //#include<unordered_map>
      9 #include <vector>
     10 #include <stack>
     11 #include <set>
     12 #include <string.h>//strstr substr
     13 #include <string>
     14 #include <time.h>//srand(((unsigned)time(NULL))); Seed n=rand()%10 - 0~9;
     15 #include <cmath>
     16 #include <deque>
     17 #include <queue>//priority_queue<int, vector<int>, greater<int> > q;//less
     18 #include <vector>//emplace_back
     19 //#include <math.h>
     20 //#include <windows.h>//reverse(a,a+len);// ~ ! ~ ! floor
     21 #include <algorithm>//sort + unique : sz=unique(b+1,b+n+1)-(b+1);+nth_element(first, nth, last, compare)
     22 using namespace std;//next_permutation(a+1,a+1+n);//prev_permutation
     23 #define fo(a,b,c) for(register int a=b;a<=c;++a)
     24 #define fr(a,b,c) for(register int a=b;a>=c;--a)
     25 #define mem(a,b) memset(a,b,sizeof(a))
     26 #define pr printf
     27 #define sc scanf
     28 #define ls rt<<1
     29 #define rs rt<<1|1
     30 typedef long long ll;
     31 void swapp(int &a,int &b);
     32 double fabss(double a);
     33 int maxx(int a,int b);
     34 int minn(int a,int b);
     35 int Del_bit_1(int n);
     36 int lowbit(int n);
     37 int abss(int a);
     38 //const long long INF=(1LL<<60);
     39 const double E=2.718281828;
     40 const double PI=acos(-1.0);
     41 const int inf=(1<<30);
     42 const double ESP=1e-9;
     43 const int mod=(int)1e9+7;
     44 const int N=(int)1e6+10;
     45 
     46 ll a[N];
     47 ll ans[705][705];
     48 
     49 int main()
     50 {
     51     int n;
     52     sc("%d",&n);
     53     fo(n_,1,n)
     54     {
     55         int judge,x,y;
     56         sc("%d%d%d",&judge,&x,&y);
     57         if(judge==1)
     58         {
     59             a[x]+=y;
     60             for(int i=1;i<=700;++i)
     61                 ans[x%i][i]+=y;
     62         }
     63         else
     64         {
     65             ll Ans=0;
     66             if(x<=700)
     67                 Ans+=ans[y][x];
     68             else
     69                 for(int i=1;i<=500000;i+=x)
     70                     Ans+=a[i+y-1];
     71             pr("%lld
    ",Ans);
     72         }
     73     }
     74     return 0;
     75 }
     76 
     77 /**************************************************************************************/
     78 
     79 int maxx(int a,int b)
     80 {
     81     return a>b?a:b;
     82 }
     83 
     84 void swapp(int &a,int &b)
     85 {
     86     a^=b^=a^=b;
     87 }
     88 
     89 int lowbit(int n)
     90 {
     91     return n&(-n);
     92 }
     93 
     94 int Del_bit_1(int n)
     95 {
     96     return n&(n-1);
     97 }
     98 
     99 int abss(int a)
    100 {
    101     return a>0?a:-a;
    102 }
    103 
    104 double fabss(double a)
    105 {
    106     return a>0?a:-a;
    107 }
    108 
    109 int minn(int a,int b)
    110 {
    111     return a<b?a:b;
    112 }
  • 相关阅读:
    BZOJ_3159_决战
    11.19 ~ 11.25训练计划+总结
    BZOJ_1304_[CQOI2009]叶子的染色_树形DP
    BZOJ_1999_[Noip2007]Core树网的核_单调队列+树形DP
    BZOJ_4033_[HAOI2015]树上染色_树形DP
    BZOJ_5338_ [TJOI2018]xor_可持久化trie
    BZOJ_2957_楼房重建_线段树
    BZOJ_3124_[Sdoi2013]直径_树形DP
    BZOJ_4987_Tree_树形DP
    「JOISC 2019 Day2」两个天线(线段树)
  • 原文地址:https://www.cnblogs.com/--HPY-7m/p/11469500.html
Copyright © 2011-2022 走看看