闲暇之余并没有好好补题而和小南瓜一起开了一场女生赛x
然而自己菜死了,没看清I的题目,还分析错了E的复杂度,导致最后只有9题
A
/* ***********************************************
Author :BPM136
Created Time :2019/8/2 13:31:09
File Name :A.cpp
************************************************ */
#include <bits/stdc++.h>
#include <sys/timeb.h>
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define filein(x) freopen(#x".in","r",stdin)
#define fileout(x) freopen(#x".out","w",stdout)
#define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
#define mkdfile() freopen("in.txt","w",stdout);
#define setlargestack(x) int _SIZE=x<<20;char *_PPP=(char*)malloc(_SIZE)+_SIZE;__asm__("movl %0, %%esp\n" :: "r"(_PPP));
#define read2(a,b) read(a),read(b)
#define read3(a,b,c) read(a),read(b),read(c)
#define readg(_x1,_y1,_x2,_y2) read(_x1),read(_y1),read(_x2),read(_y2)
#define USE_CIN_COUT ios::sync_with_stdio(0)
using namespace std;
int random(int l, int r) {
static std::random_device rd;
struct timeb timeSeed;
ftime(&timeSeed);
size_t seed = timeSeed.time * 1000 + timeSeed.millitm; // milli time
static std::mt19937 gen(seed);
std::uniform_int_distribution<> u(l, r);
return u(gen);
}
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int, int> pii;
namespace fastIO{
#define BUF_SIZE 100000
#define OUT_SIZE 100000
//fread->read
bool IOerror=0;
inline char nc(){
static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
if (p1==pend){
p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);
if (pend==p1){
IOerror=1;return -1;}
//{printf("IO error!\n");system("pause");for (;;);exit(0);}
}
return *p1++;
}
inline bool blank(char ch){
return ch==32||ch==10||ch==13||ch==9;}
inline bool enter(char ch){
return ch==10||ch==13;}
inline void read(int &x){
bool sign=0; char ch=nc(); x=0;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch==45)sign=1,ch=nc();
for (;ch>=48&&ch<=57;ch=nc())x=x*10+ch-48;
if (sign)x=-x;
}
inline void read(ll &x){
bool sign=0; char ch=nc(); x=0;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch==45)sign=1,ch=nc();
for (;ch>=48&&ch<=57;ch=nc())x=x*10+ch-48;
if (sign)x=-x;
}
inline void read(double &x){
bool sign=0; char ch=nc(); x=0;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch==45)sign=1,ch=nc();
for (;ch>=48&&ch<=57;ch=nc())x=x*10+ch-48;
if (ch==46){
double tmp=1; ch=nc();
for (;ch>=48&&ch<=57;ch=nc())tmp/=10.0,x+=tmp*(ch-48);
}
if (sign)x=-x;
}
inline void read(char *s){
char ch=nc();
for (;blank(ch);ch=nc());
if (IOerror)return;
for (;!blank(ch)&&!IOerror;ch=nc())*s++=ch;
*s=0;
}
inline void readln(char *s) {
char ch=nc();
for (;blank(ch);ch=nc());
if(IOerror)return;
for(;!enter(ch)&&!IOerror;ch=nc())*s++=ch;
*s=0;
}
inline void read(char &c){
for (c=nc();blank(c);c=nc());
if (IOerror){
c=-1;return;}
}
#undef OUT_SIZE
#undef BUF_SIZE
}
using fastIO::read;
int main() {
int n;
scanf("%d",&n);
double sum = 0;
for(int i = 0;i < n;i++) {
int x;
scanf("%d",&x);
if(sum >= 100 && sum < 150) x *= 0.8;
else if(sum >= 150 && sum < 400) x *= 0.5;
sum += x;
}
printf("%.2f\n",sum);
return 0;
}
B
其实可以根号n的复杂度,但是实际上直接算sum然后枚举约数也是根号n复杂度(可以思考下为什么
/* ***********************************************
Author :BPM136
Created Time :2019/8/2 13:53:50
File Name :B.cpp
************************************************ */
#include <bits/stdc++.h>
#include <sys/timeb.h>
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define USE_CIN_COUT ios::sync_with_stdio(0)
#define filein(x) freopen(#x".in","r",stdin)
#define fileout(x) freopen(#x".out","w",stdout)
#define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
#define mkd(x) freopen(#x".in","w",stdout);
using namespace std;
int random(int l, int r) {
static std::random_device rd;
struct timeb timeSeed;
ftime(&timeSeed);
size_t seed = timeSeed.time * 1000 + timeSeed.millitm; // milli time
static std::mt19937 gen(seed);
std::uniform_int_distribution<> u(l, r);
return u(gen);
}
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int main() {
ll n;
cin >> n;
ll sum = (n + 1) * n / 2;
for (ll i = 2; i * i <= sum; ++i)
if (sum % i == 0) {
cout << sum / i << '\n';
return 0;
}
return 0;
}
C
考虑最开始就分配好每个都是1,然后不足的部分慢慢+1挪过去,因为开口朝上的二次函数的delta y是递增的,所以是对的