用Java解决“三天打渔两天晒网”的问题(1)
中国有句俗语叫“三天打鱼两天晒网”。某人从2010年1月1日起开始“三天打鱼两天晒网”,问这个人在以后的某一天中是“打渔”还是“晒网”。
基本要求:1.程序风格良好(使用自定义注释模板),提供友好的输入输出。
提高要求:1.输入数据的正确性验证。
2.使用文件进行数据测试。如将日期 20100101 20111214 等数据保存在in.txt文...
统计csdn博客的访问量+评论数
两周前,ip被封了,所以爬虫有风险,访问需谨慎,还好有代理IP
# coding=utf-8
import requests
from bs4 import BeautifulSoup
#总的访问量+评论数
sum = 0
#20是页数,自己设
for i in range(20):
print("第",i+1,"页")
url = "https://blog.csdn.net/...
js笔记DOM篇(两个小例题)
87.课堂练习
请编写一段JavaScript脚本生成下面这段DOM结构。要求:使用标准的DOM方法或属性。
<div class="example">
<p class="slogan">姬成,长的还行 </p>
<strong>邓哥,amazing </strong>
</div>
AUX_RGBImageRec auxRGBImageLoad 等函数意义
OpenGL可以把纹理映射到指定的图形的表面上。简单一点的,就是给平面映射纹理,比如一个四边形,一个长方体的6个面,都可以指定位图作为纹理映射到各个面上。
关于将一个位图作为纹理映射到某个或者多个面上,可以学习Jeff Molofee的OpenGL系列教程。
对于指定的多个纹理,要根据自己的需要映射到不同的面上,需要对位图创建一个数组,用来存储位图的名称,然后在初始化OpenGL的时候,可以读...
电子资源账务管理系统(electronic_resources)_ssh_mysql
电子资源账务管理系统采用ssh框架开发,数据库采用mysql数据库,开发工具是myeclipse,提供基本增删改查,后台分页,图片上传,附件上传,富文本编辑器,时间选择器等功能。
2018 Multi-University Training Contest
2018 Multi-University Training Contest 1
过题情况
1001
1003
1011
补题情况
1002
1004
——–
1.1001
1.1001题意
给你一个整数n,要求x,y,z是n的因子而且x+y+z=n,求x*y*z的最大值。
1.1001做法
我们假设
x=nax=nax=\frac{n}{a}
y=nby=nby...
Educational Codeforces Round 48 (Rated for Div. 2)
总结
这场由于过于着急B题意读错卡B卡了将近40分钟,导致C写完由于数组开小了没时间改好,同时也导致一个赛后十分钟秒了的D根本没时间看。读题很重要啊!!!
A题 Death Note
水题直接上代码
https://paste.ubuntu.com/p/mt846nYfqh/
B题 Segment Occurrences
就是预处理+前缀和,注意查询时范围的处理就好了
htt...
【队内训练】20162017-acmicpc-neerc-central-subregional-contest题解
20162017-acmicpc-neerc-central-subregional-contest
A Fried Fish (签到) 84 / 304
B Hanoi tower (推公式) 12 / 48(赛后过掉)
C Desktop (构造) 16 / 71 (赛后过掉)
D Weather Station (签到) 66 / 10...
【Codeforces Round #340 (Div. 2), problem: (E) XOR and Favorite Number】 莫队算法
http://codeforces.com/contest/617/problem/E
题意就是给出n个数的序列和数字k,q次询问,每次询问给出[L,R],求这个区间内有多少个连续区间的异或和等于k。
由于我们知道
A[i]XorA[i+1]Xor....XorA[j]A[i]XorA[i+1]Xor....XorA[j]A[i]XorA[i+1]Xor....XorA[j]=(A[1]Xo...
【BZOJ 2038 [2009国家集训队]小Z的袜子(hose)】 莫队算法
BZOJ 2038
题意就是给你一个n个数字的数字序列,Q次查询操作给一个[L,R],求从这个区间任取两个数而且这两个数相等的概率
我们可以统计这个区间每种数的个数sum[x],数字x对答案的贡献为x*(x-1),最后除以整个区间的方案数len*(len-1)就可以了,所以add函数的时候,一个新的x对答案的贡献就是加入x之前的sum[x],del函数的时候,减少的应该是删除x之后的sum[x...
PAT甲1046 Shortest Distance (20)(20 分)
#include <string.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
int N,M;
int dis[100010];
int main()
{
scanf("%d",&N);
int sum=0,a;
for(int i=1;i&l...
PAT甲1047 Student List for Course(25 分)
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
int N,M;
vector<int> C[2510];
char name[41000][5];
bool cmp(int a,in...
PAT甲1048 Find Coins (25)(25 分)
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
int N,M;
int harsh[1010];
int A[100010];
int minv=1100;
int main()
{
s...
PAT甲1049 Counting Ones (30)(30 分)
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
int a;
int main()
{
scanf("%d",&a);
int left=a,right=0,exp=1;
...
PAT甲1050 String Subtraction (20)(20 分)
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;
string a,b;
int harsh[140];
int main()
{
getl...
PAT甲1051 Pop Sequence (25)(25 分)
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <iostream>
#include <stack>
using namespace std;
int A[1010];
int main()
{
...
PAT甲1052 Linked List Sorting (25)(25 分)
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <string>
using namespace std;
struct node
{
int now;
int next;
int data;
node()
PAT甲1053 Path of Equal Weight (30)(30 分)
对最终整个path数组排序,产生了段错误,不明白为啥……
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
struct node
{
int ...
PAT甲1054 The Dominant Color (20)(20 分)
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int N,M;
int main()
{
int now=-1,num=1;
sca...
PAT甲1055 The World's Richest(25 分)
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
struct person
{
char name[10];
int age;
...
今日推荐
周排行