关于26日晚上的比赛,这几次打的都很差,特别是这场,A题秒思路,可是a,b数据范围为什么也是long long ,一直卡在第二个点上,至于到了B题,大约50分钟,把每个字符串都改成 01010101,可是样例都不了,但是题目里有句话没注意:
k is the minimum positive integer with this property。。。。。最小正周期应该是不能再随意更改的吧
当时晚上直接心态崩掉,因为确实想法没错,细节上出了岔子,可能是平时练习光看题解的报应
A. Road To Zero
题目链接:https://codeforces.ml/contest/1342/problem/A
#include
#include
#include
#include
#include
#include
#define rush() int T;cin>>T;while(T--)
#define sf(a) scanf("%d\n",&a)
#define sft(a,b) scanf("%d%d",&a,&b)
#define go(a) while(cin>>a&&a)
#define ms(a,b) memset(a,b,sizeof a)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define pf(a) printf("%.8lf",a)
#define valu first
#define num second
#define E 1e-8
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double pi=acos(-1.0);
const int inf=0x3f3f3f3f;
const int idata=1e6+5;
int n,m,t;
int maxx,minn;
int i,j,k;
//int a[idata],b[idata];
int main()
{
cin.tie(0);
iostream::sync_with_stdio(false);
rush()
{
ull sum=0;
ll x,y,a,b;
cin>>x>>y;
cin>>a>>b;
maxx=max(x,y);
minn=min(x,y);
if(a*2>=b)
{
if(maxx==minn) sum=maxx*b;
else
{
sum=b*(minn);
sum+=a*(maxx-minn);
}
}
else
{
sum=(minn+maxx)*a;
}
cout<
B. Binary Period
题目链接:https://codeforces.ml/contest/1342/problem/B
#include
#include
#include
#include
#include
#include
#define rush() int T;cin>>T;while(T--)
#define sf(a) scanf("%d\n",&a)
#define sft(a,b) scanf("%d%d",&a,&b)
#define go(a) while(cin>>a&&a)
#define ms(a,b) memset(a,b,sizeof a)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define pf(a) printf("%.8lf",a)
#define valu first
#define num second
#define E 1e-8
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double pi=acos(-1.0);
const int inf=0x3f3f3f3f;
const int idata=1e6+5;
int n,m,t;
int maxx,minn;
int i,j,k;
//int a[idata],b[idata];
int main()
{
cin.tie(0);
iostream::sync_with_stdio(false);
rush()
{
int flag1=0,flag0=0;
string s;
cin>>s;
for(i=0;i
题目链接:https://codeforces.ml/contest/1342/problem/C
C. Yet Another Counting Problem
题意:给两个数a、b, 再给 q 个范围 l、r,问在 l~r 的范围中有多少个数x是 x % a % b != x % b % a ,输出符合条件的数的个数
#include
#define rush() int T;cin>>T;while(T--)
#define sf(a) scanf("%d\n",&a)
#define sft(a,b) scanf("%d%d",&a,&b)
#define go(a) while(cin>>a&&a)
#define ms(a,b) memset(a,b,sizeof a)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define pf(a) printf("%.8lf",a)
#define valu first
#define num second
#define E 1e-8
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double pi=acos(-1.0);
const int inf=0x3f3f3f3f;
const int idata=1e6+5;
ll n,m,t,a,b;
int maxx,minn;
int i,j,k;
int pre[idata];
ll calc(ll num){
//在每一段长度为maxx的的区间内,存在0--b-1共b个数,使得式子相等
ll cnt=num/maxx;
//在剩下的最后一段中
ll res=num%maxx+1;//num-cnt*maxx--num 区间内的数字 别忘了加一
//可能存在满足条件的数的个数 res>b 的情况,强调一下是 个数
return num-cnt*b-min(res,b);
}
int main()
{
cin.tie(0);
iostream::sync_with_stdio(false);
rush()
{
int q;
cin>>a>>b>>q;
if(a>b) swap(a,b);
maxx=a*b/__gcd(a,b);
minn=b;
while(q--){
ll l,r;
cin>>l>>r;
cout<
----------转载
之后的题连题解都看不懂了,之后更新