4.1w+
社区成员
#include <iostream>
using namespace std;
int main()
{
// 请在此输入您的代码
cout << 440 - 1 + 4 <<endl;
return 0;
}
#include <iostream>
#include <bits/stdc++.h>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#define x first
#define y second
#define fu(i,a,b) for(int i=a;i<=b;i ++ )
#define fd(i,a,b) for(int i=a;i>=b;i -- )
#define endl '\n'
#define ms(x,y) memset(x,y,sizeof x)
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef long long LL;
typedef vector<vector<LL>> VVL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef pair<double,int> PDI;
typedef pair<char,int> PCI;
typedef pair<string,int> PSI;
typedef pair<int,string> PIS;
typedef pair<LL,LL> PLL;
typedef __int128 i128;
typedef unsigned long long ULL;
const int N = 500+ 10,M = N * 4,INF = 0x3f3f3f3f ;
const int mod = 1e9;
const double eps = 1e-8;
inline void solve()
{
LL a,b,n;
cin >> a >> b >> n ;
LL cnt = 0,res =0,sum = a * 5 + b* 2 ;
cnt += n/sum * 7 ;
n %= sum;
while(res < n )
{
if(cnt % 7 < 5 ) res += a;
else res +=b;
cnt ++ ;
}
cout << cnt<< endl;
}
signed main()
{
// freopen("1.txt","w",stdout);
ios
int t=1;
// cin>>t;
int now = 1;
while(t -- )
{
// cout<<"Case ";
// cout<<"Scenario #";
// cout<< now ++ <<": ";
// cout<< now ++ <<": \n";
solve();
}
return 0;
}
#include <iostream>
#include <bits/stdc++.h>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#define x first
#define y second
#define fu(i,a,b) for(int i=a;i<=b;i ++ )
#define fd(i,a,b) for(int i=a;i>=b;i -- )
#define endl '\n'
#define ms(x,y) memset(x,y,sizeof x)
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef long long LL;
typedef vector<vector<LL>> VVL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef pair<double,int> PDI;
typedef pair<char,int> PCI;
typedef pair<string,int> PSI;
typedef pair<int,string> PIS;
typedef pair<LL,LL> PLL;
typedef __int128 i128;
typedef unsigned long long ULL;
const int N = 500+ 10,M = N * 4,INF = 0x3f3f3f3f ;
const int mod = 1e9;
const double eps = 1e-8;
inline void solve()
{
int n;
cin >> n;
fu(i,1,n)
cout << max(i-1,n-i) * 2 << endl;
}
signed main()
{
// freopen("1.txt","w",stdout);
ios
int t=1;
// cin>>t;
int now = 1;
while(t -- )
{
// cout<<"Case ";
// cout<<"Scenario #";
// cout<< now ++ <<": ";
// cout<< now ++ <<": \n";
solve();
}
return 0;
}
#include <iostream>
#include <bits/stdc++.h>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#define x first
#define y second
#define fu(i,a,b) for(int i=a;i<=b;i ++ )
#define fd(i,a,b) for(int i=a;i>=b;i -- )
#define endl '\n'
#define ms(x,y) memset(x,y,sizeof x)
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef long long LL;
typedef vector<vector<LL>> VVL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef pair<double,int> PDI;
typedef pair<char,int> PCI;
typedef pair<string,int> PSI;
typedef pair<int,string> PIS;
typedef pair<LL,LL> PLL;
typedef __int128 i128;
typedef unsigned long long ULL;
const int N = 500+ 10,M = N * 4,INF = 0x3f3f3f3f ;
const int mod = 1e9;
const double eps = 1e-8;
inline void solve()
{
int n,m;
cin >> n >> m ;
vector<int> cnt(m + 10 );
vector<LL> s(n+10);
fu(i,1,n)cin >> s[i],s[i] += s[i-1];
LL res =0 ;
cnt[0] ++ ;
fu(i,1,n)res += cnt[s[i] % m ] ++ ;
cout << res <<endl;
}
signed main()
{
// freopen("1.txt","w",stdout);
ios
int t=1;
// cin>>t;
int now = 1;
while(t -- )
{
// cout<<"Case ";
// cout<<"Scenario #";
// cout<< now ++ <<": ";
// cout<< now ++ <<": \n";
solve();
}
return 0;
}
#include <iostream>
#include <bits/stdc++.h>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#define x first
#define y second
#define fu(i,a,b) for(int i=a;i<=b;i ++ )
#define fd(i,a,b) for(int i=a;i>=b;i -- )
#define endl '\n'
#define ms(x,y) memset(x,y,sizeof x)
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef long long LL;
typedef vector<vector<LL>> VVL;
typedef vector<LL> VL;
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef pair<double,int> PDI;
typedef pair<char,int> PCI;
typedef pair<string,int> PSI;
typedef pair<int,string> PIS;
typedef pair<LL,LL> PLL;
typedef __int128 i128;
typedef unsigned long long ULL;
const int N = 1e6+ 10,M = N * 4,INF = 0x3f3f3f3f ;
const int mod = 1e9;
const double eps = 1e-8;
int n,m;
unordered_map<int,vector<int>> tr;
int find(VL &t,LL x)
{
return lower_bound(t.begin(),t.end(),x) - t.begin() + 1;
}
int lowbit(int x)
{
return x & -x ;
}
void add(VI & t,int x,LL c)
{
for(int i=x;i<t.size();i+=lowbit(i)) t[i] += c;
}
LL sum(VI &t,int x)
{
LL res =0 ;
for(int i=x;i;i-=lowbit(i)) res += t[i];
return res;
}
inline void solve()
{
cin >> n >> m ;
unordered_map<int,vector<LL>> cnt;
vector<LL> s(n+10);
LL res =0 ;
fu(i,1,n)
{
cin >> s[i],s[i] += s[i-1];
int t = (s[i] % m + m ) % m;
cnt[t].push_back(s[i]);
}
for(auto &t: cnt )
{
VL &ve =t.y ;
sort(ve.begin(),ve.end());
ve.erase(unique(ve.begin(),ve.end()),ve.end());
tr[t.x] = VI(ve.size()+1,0);
}
fu(i,1,n)
{
int t =(s[i] % m + m ) % m;
int x = find(cnt[t],s[i]);
if(!t && s[i] >= 0 ) res ++ ;
res += sum(tr[t],x);
add(tr[t],x,1);
}
cout << res <<endl;
}
signed main()
{
// freopen("1.txt","w",stdout);
ios
int t=1;
// cin>>t;
int now = 1;
while(t -- )
{
// cout<<"Case ";
// cout<<"Scenario #";
// cout<< now ++ <<": ";
// cout<< now ++ <<": \n";
solve();
}
return 0;
}