Sol

又是一道zz网络流

我的构图长这样,$k_i$表示第$i$道试题需要的数量

图片 1

#include<cstdio>#include<queue>#include<cstring>using namespace std;const int MAXN = 1e5 + 10, INF = 1e9 + 10;inline int read() {    char c = getchar(); int x = 0, f = 1;    while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();    return x * f;}int K, N, S, T;int need[MAXN];vector<int>ans[MAXN];struct Edge {    int u, v, f, nxt;}E[MAXN];int head[MAXN], cur[MAXN], num;inline void add_edge(int x, int y, int f) {    E[num] = {x, y, f, head[x]};    head[x] = num++;}inline void AddEdge(int x, int y, int z) {    add_edge;    add_edge(y, x, 0);}int sum = 0, deep[MAXN];bool BFS() {    queue<int> q; q.push;    memset(deep, 0, sizeof; deep[S] = 1;    while(!q.empty {        int p = q.front(); q.pop();        for(int i = head[p]; i != -1; i = E[i].nxt) {            int to = E[i].v;            if(!deep[to] && E[i].f) {                deep[to] = deep[p] + 1;                q.push;            }        }    }    return deep[T] > 0;}int DFS(int x, int flow) {    if return flow;    int ansflow = 0;    for(int &i = cur[x]; i != -1; i = E[i].nxt) {        int to = E[i].v;        if(deep[to] == deep[x] + 1 && E[i].f) {            int nowflow = DFS(to, min(flow, E[i].f));            E[i].f -= nowflow; E[i ^ 1].f += nowflow;            ansflow += nowflow; flow -= nowflow;            if(flow <= 0) break;        }    }    return ansflow;}int Dinic() {    int ans = 0;    while {        memcpy(cur, head, sizeof;        ans += DFS;    }    return ans;}int main() {    memset(head, -1, sizeof;    K = read(); N = read(); S = 0; T = N + K + 1;    int sum = 0;    for(int i = 1; i <= K; i++) {        int x = read(); sum += x;        AddEdge(N + i, T, x);    }    for(int i = 1; i <= N; i++) {        int n = read();        AddEdge(S, i, 1);        for(int j = 1; j <= n; j++) {            AddEdge + N, 1);        }    }    if < sum) {puts("No Solution!"); return 0;}    for(int x = 1; x <= N; x++)         for(int i = head[x]; i != -1; i = E[i].nxt)             if(E[i].f == 0)                 ans[E[i].v - N].push_back;    for(int i = 1; i <= K; i++) {        printf("%d: ", i);        for(int j = 0; j < ans[i].size printf("%d ", ans[i][j]);        puts("");    }    return 0;}

6.建根目录,并设置访问权限

5.14 使用Test Restful Web Service进行接口测试如下:

题意

$n$道试题,每道题有多种类别属性

抽取$m$道题组成试卷,要求包含指定的类型

输出方案

重启防火墙

4.8 配置Mybatis-Generator生成器

//vsftpd: unrecognized service 找不到vsftpd

5.9No active profile set, falling back to default profiles: default这个错误是由于idea没有设置默认启动环境。具体设置如下:

//查找ftp

4.7在pom文件中添加依赖包

查看防火墙状态

4.6.4创建controller层:同上

local_root=/var/www
//自己网站的根目录,我的是www下,当登录FTP后就会到www这个目录

4.5.1src\main\java存放源文件

useradd test -s /sbin/nologin //添加用户名为test

图片 2

7.重启vsftpd服务器

2.1.4 Maven Version:3.5.4

5、编辑user_list文件,允许test用户访问FTP

4.7.4 添加mysql-connector-java依赖,选择5.1.38版本

//vsftpd-3.0.2-22.el7.x86_64 (此处是查找vsftpd的返回结果)

5. 错误抛析及解决方法

firewall-cmd –permanent –zone=public –add-service=ftp

4.6.5创建springboot启动:同上

//vsftpd: unrecognized service 找不到vsftpd

4.7.3 添加mybatis-spring-boot-starter依赖,选择1.3.2版本

chmod -R 777 /var/www //给用户目录最大权限

2.1.3 MySql Version:MySql 5.7

卸载ftp方法

 1 package com.wuji.service; 2  3 import com.wuji.entity.po.User; 4  5 public interface UserService { 6     int addUser(User user); 7     int delUserById(int id); 8     int updateUserById(int id,String userName); 9     User getUserById(int id);10 }

systemctl start vsftpd.service

张无忌专注Java技术10余年,产品控、代码控,拥有丰富的项目经验,主持研发了多个成功上线的大型互联网项目

vi /etc/vsftpd/user_list

1.1为什么要使用Spring boot?

userlist_deny=NO

5.3配置mybatis-generator时,working directory要设置成模块路径如:E:\JavaProjects\pring_boot_mybatis

设置完以后,按下 Esc 退出编辑模式,再按下:wq保存退出。

2.1.5 Mybatis-Generator Version:1.3.5

好了到这里就算完成了。。。。。。。

4.6.6最终结构图如下:

systemctl start vsftpd.service

5.2在启动类上添加@SpringBootApplication注解时,不能引入包;原因是:没有下载依赖

检查是否卸载了vsftpd,进行stop及start操作

5.13.spring boot 启动器文件

如果登录出现530 Permission denied,输入:vi /etc/vsftpd/ftpusers
查看root是不是在里面,有的话删除,保存退出,再

5.10Caused by: java.lang.ClassNotFoundException:
org.springframework.boot.bind.RelaxedPropertyResolver这个错误是由于没有添加:<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
</parent>从而找不到RelaxedPropertyResolver这个类

注:如果开启防火墙的话,需要设置一下

图片 3

chown -R test /var/www

2.1.6 Http Test Restful Webservice Idea带,没看到版本号

按 i
编辑文件,找到anon_mkdir_write_enable=YES,修改成anon_mkdir_write_enable=NO
//不允许匿名登录FTP

4.1spring_boot_mybatis模块创建:File->New->Module如下图

如果配置出错需要卸载vsftpd,在卸载之前先停止vsftpd

7.张无忌介绍:

图片 4

5.11Failed to configure a DataSource: ‘url’ attribute is not specified
and no embedded datasource could be configured.还是出现在yml文件节点。具体是druid:这个节点,要有层次结构。详见yml文件。

开启ftp

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE generatorConfiguration        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> <generatorConfiguration>   <classPathEntry location="D:\MyBatisGenerator\mysql-connector-java-5.1.38.jar"/>    <context  targetRuntime="MyBatis3" defaultModelType="flat">         <commentGenerator>            <property name="suppressAllComments" value="true"/>            <property name="suppressDate" value="true" />        </commentGenerator>        <jdbcConnection driverClass="com.mysql.jdbc.Driver"                        connectionURL="jdbc:mysql://localhost:3306/daducha"                        userId="root"                        password="root">        </jdbcConnection>         <javaTypeResolver>            <property name="forceBigDecimals" value="false" />        </javaTypeResolver>        <!--生成PO实体类-->        <javaModelGenerator targetPackage="com.wuji.entity.po"  targetProject="src/main/java">            <property name="trimStrings" value="true" />        </javaModelGenerator>        <!--生成Mybatis XML Mapper Sql操作-->        <sqlMapGenerator targetPackage="mapping" targetProject="src/main/resources">        </sqlMapGenerator>        <!--生成Mybatis Mpper数据操作接口-->        <javaClientGenerator type="XMLMAPPER" targetPackage="com.wuji.mapper"  targetProject="src/main/java">        </javaClientGenerator>                <table tableName="users" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"  selectByExampleQueryId="false"/>       <!--          <table tableName="%">            <generatedKey column="id" sqlStatement="Mysql"/>        </table>        -->    </context></generatorConfiguration>

use_localtime=YES

4.8.3 设置generatorConfig.xml文件,具体如下:

4.添加FTP账户

4.9
application.yml文件配置(格式很严格,注意节点的缩近和对齐,有问题直接加微信回复更快

passwd test
//好像必须写新建的用户名,确认之后会提示2次输入密码,直接输入想好的密码就好了

1.概要

yum install -y vsftpd

4.6.3创建entity层:同上

systemctl stop vsftpd.service

package com.wuji.entity.po;public class User {    private Integer id;    private String name;    private Integer age;    public Integer getId() {        return id;    }    public void setId(Integer id) {        this.id = id;    }    public String getName() {        return name;    }    public void setName(String name) {        this.name = name == null ? null : name.trim();    }    public Integer getAge() {        return age;    }    public void setAge(Integer age) {        this.age = age;    }}

Mapper文件:

package com.wuji.mapper;import com.wuji.entity.po.User;public interface UserMapper {    int deleteByPrimaryKey(Integer id);    int insert(User record);    int insertSelective(User record);    User selectByPrimaryKey(Integer id);    int updateByPrimaryKeySelective(User record);    int updateByPrimaryKey(User record);}

Mapping文件(按照规则放在了资源文件夹下面):

 1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 3 <mapper namespace="com.wuji.mapper.UserMapper"> 4   <resultMap  type="com.wuji.entity.po.User"> 5     <id column="id" jdbcType="INTEGER" property="id" /> 6     <result column="name" jdbcType="VARCHAR" property="name" /> 7     <result column="age" jdbcType="INTEGER" property="age" /> 8   </resultMap> 9   <sql >10     id, name, age11   </sql>12   <select  parameterType="java.lang.Integer" resultMap="BaseResultMap">13     select 14     <include ref />15     from users16     where id = #{id,jdbcType=INTEGER}17   </select>18   <delete  parameterType="java.lang.Integer">19     delete from users20     where id = #{id,jdbcType=INTEGER}21   </delete>22   <insert  parameterType="com.wuji.entity.po.User">23     insert into users (id, name, age24       )25     values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER}26       )27   </insert>28   <insert  parameterType="com.wuji.entity.po.User">29     insert into users30     <trim prefix="(" suffix=")" suffixOverrides=",">31       <if test="id != null">32         id,33       </if>34       <if test="name != null">35         name,36       </if>37       <if test="age != null">38         age,39       </if>40     </trim>41     <trim prefix="values (" suffix=")" suffixOverrides=",">42       <if test="id != null">43         #{id,jdbcType=INTEGER},44       </if>45       <if test="name != null">46         #{name,jdbcType=VARCHAR},47       </if>48       <if test="age != null">49         #{age,jdbcType=INTEGER},50       </if>51     </trim>52   </insert>53   <update  parameterType="com.wuji.entity.po.User">54     update users55     <set>56       <if test="name != null">57         name = #{name,jdbcType=VARCHAR},58       </if>59       <if test="age != null">60         age = #{age,jdbcType=INTEGER},61       </if>62     </set>63     where id = #{id,jdbcType=INTEGER}64   </update>65   <update  parameterType="com.wuji.entity.po.User">66     update users67     set name = #{name,jdbcType=VARCHAR},68       age = #{age,jdbcType=INTEGER}69     where id = #{id,jdbcType=INTEGER}70   </update>71 </mapper>

发表评论

电子邮件地址不会被公开。 必填项已用*标注