一个田螺突然就

如清风徜徉

合集

3498. 日期差值

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string a,b;
int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int isleap(int y)
{
if((y%4==0&&y%100!=0)||(y%400==0))
{
return 1;
}
return 0;
}
ll getday(string a)
{
int y=atoi((a.substr(0,4)).c_str());
int m=atoi((a.substr(4,2)).c_str());
int d=atoi((a.substr(6,2)).c_str());
ll day=d;
// cout<<y<<" "<<m<<" "<<d<<endl;
if(isleap(y))
{
mon[2]=29;
}
else
{
mon[2]=28;
}
for(int i=1;i<m;i++)
{
day=day+(ll)(mon[i]);
}
for(int i=1;i<y;i++)
{
if(isleap(i))
{
day=day+366;
}
else
{
day=day+365;
}
}
// cout<<day<<endl;
return day;
}
int main()
{
while(cin>>a>>b)
{
ll daya=getday(a);
ll dayb=getday(b);
cout<<abs(daya-dayb)+1<<endl;
}
return 0;
}

3489. 星期几

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string m;
int y,d;
string month[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};
string week[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
map<string,int> mp={
{"January",1},
{"February",2},
{"March",3},
{"April",4},
{"May",5},
{"June",6},
{"July",7},
{"August",8},
{"September",9},
{"October",10},
{"November",11},
{"December",12}
};
int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int isleap(int y)
{
if((y%4==0&&y%100!=0)||(y%400==0))
{
return 1;
}
return 0;
}
string getday(int y,int m,int d)
{

ll day=d;
// cout<<y<<" "<<m<<" "<<d<<endl;
if(isleap(y))
{
mon[2]=29;
}
else
{
mon[2]=28;
}
for(int i=1;i<m;i++)
{
day=day+(ll)(mon[i]);
}
for(int i=1;i<y;i++)
{
if(isleap(i))
{
day=day+366;
}
else
{
day=day+365;
}
}
day=(day-1)%7;
// cout<<day<<endl;
return week[day];
}
int main()
{
while(cin>>d>>m>>y)
{
cout<<getday(y,mp[m],d)<<endl;;
}
return 0;
}

3573.日期累加

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int m,n,s;
int y,d;
string month[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};
string week[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
map<string,int> mp={
{"January",1},
{"February",2},
{"March",3},
{"April",4},
{"May",5},
{"June",6},
{"July",7},
{"August",8},
{"September",9},
{"October",10},
{"November",11},
{"December",12}
};
int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int isleap(int y)
{
if((y%4==0&&y%100!=0)||(y%400==0))
{
return 1;
}
return 0;
}
void getday(int y,int m,int d,int s)
{

// cout<<y<<" "<<m<<" "<<d<<endl;
d+=s;
if(isleap(y))
{
mon[2]=29;
}
else
{
mon[2]=28;
}
while(d>mon[m])
{
d-=mon[m];
if(isleap(y))
{
mon[2]=29;
}
else
{
mon[2]=28;
}
m++;
if(m>12)
{
m=1;
y++;
}
}
cout<<y<<"-";
if(m<10)cout<<0;
cout<<m<<"-";
if(d<10)cout<<0;
cout<<d<<endl;

}
int main()
{
cin>>n;
while(n--)
{
cin>>y>>m>>d>>s;
getday(y,m,d,s);
}
return 0;
}

1341. 十三号星期五

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string m;
int y,d,n;
string month[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};
string week[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
int a[8];
int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int isleap(int y)
{
if((y%4==0&&y%100!=0)||(y%400==0))
{
return 1;
}
return 0;
}
void getday(int n)
{
int cnt=0;
for(int i=1900;i<=1900+n-1;i++)
{
if(isleap(i))
{
mon[2]=29;
}
else
{
mon[2]=28;
}
for(int j=1;j<=12;j++)
{
for(int d=1;d<=mon[j];d++)
{
cnt=(cnt+1)%7;
if(d==13)
{
a[cnt]++;
}
}
}
}
cout<<a[6]<<" "<<a[0]<<" ";
for(int i=1;i<=5;i++)
{
cout<<a[i]<<" ";
}
cout<<endl;
}
int main()
{
while(cin>>n)
{
getday(n);
}
return 0;
}

466. 回文日期

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string a,b;
int ans;
int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int isleap(int y)
{
if((y%4==0&&y%100!=0)||(y%400==0))
{
return 1;
}
return 0;
}
int ok(int y,int m,int d)
{
if(y/1000!=d%10)return 0;
if(y/100%10!=d/10)return 0;
if(y/10%10!=m%10)return 0;
if(y%10!=m/10)return 0;
return 1;
}
void getday(string a,string b)
{
int y=stoi((a.substr(0,4)));
int m=stoi((a.substr(4,2)));
int d=stoi((a.substr(6,2)));
int yb=stoi((b.substr(0,4)));
int mb=stoi((b.substr(4,2)));
int db=stoi((b.substr(6,2)));
// ll day=d;
// cout<<y<<" "<<m<<" "<<d<<endl;
if(isleap(y))
{
mon[2]=29;
}
else
{
mon[2]=28;
}
while(1)
{
if(ok(y,m,d))ans++;
if(y==yb&&m==mb&&d==db)break;
d++;
if(isleap(y))
{
mon[2]=29;
}
else
{
mon[2]=28;
}
if(d>mon[m])
{
m++;
d=1;
}
if(m>12)
{
y++;
m=1;
}
}
cout<<ans<<endl;
}
int main()
{
while(cin>>a>>b)
{
if(a>b)swap(a,b);
// cout<<a<<" "<<b<<endl;
getday(a,b);
}
return 0;
}

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
2
3
4
hexo clean
hexo g
hexo d
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

1
2
3
4
5
6
7
8
9
10
git status 查看修改文件
git add <fileName> 加入修改文件
git commit -m 'xxxx' 新填一条commit
git log 查看所有commit
git rebase -i HEAD / git rebase -i HEAD~2 合并前2条commit
合并的时候选择squash即可
然后删掉第二条commit的内容
cr
i
编辑

github 镜像:https://bgithub.xyz

1
2
3
4
5
6
7
8
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ortools
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/

pip install torch==1.4.0+cu100 -f https://download.pytorch.org/whl/torch_stable.html

sftp 同步
参考:https://zhuanlan.zhihu.com/p/592665950

1
2
3
4
5
6
7
8
9
10
11
{
"name": "My Server",
"host": "10.224.128.25",
"protocol": "sftp",
"port": 22,
"username": "buzhidaoshei",
"remotePath": "/home/buzhidaoshei/repo/autoamenu",
"uploadOnSave": true,
"useTempFile": false,
"openSsh": false
}
0%