8.15 10:35

This commit is contained in:
ljcjames 2022-08-15 10:35:14 +08:00
parent 5b0f72e5b3
commit 752b3613ec
22 changed files with 154 additions and 30 deletions

View File

@ -0,0 +1,5 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
URL=https://vjudge.net/contest/509214
IDList=

BIN
8.13/B-Suspicious/B.pdf (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -3,12 +3,14 @@
#include <algorithm>
#include <cmath>
using namespace std;
int n, m, k;
int gcd(int a, int b)
// #define int long long
// #define %d %ld
long long n, m, k;
long long gcd(long long a, long long b)
{
while (b != 0)
{
int tmp = a;
long long tmp = a;
a = b;
b = tmp % b;
}
@ -18,28 +20,28 @@ int main()
{
// freopen("bout.txt","w",stdout);
scanf("%d%d%d", &n, &m, &k);
printf("%d %d %d \n",n,m,k);
int s = n * m / k * 2;
if (n * m * 2 % k != 0)
scanf("%ld%ld%ld", &n, &m, &k);
// printf("%ld %ld %ld \n",n,m,k);
long long s = n * m / k * 2;
if ((n * m * 2 )% k != 0)//¶¼ÊÇint µÄ´í
{
printf("%d %d %d %d \n",n,m,k,n * m * 2 % k);
printf("\\NO");
// printf("%ld %ld %ld %ld \n",n,m,k,n * m * 2 % k);
printf("NO");
return 0;
}
int n1 = gcd(k, n), m1 = gcd(k / n1, m);
int n2 = n / n1, m2 = m / m1;
long long n1 = gcd(k, n), m1 = gcd(k / n1, m);
long long n2 = n / n1, m2 = m / m1;
if (n2 * m2 / 2 * 2 == s) //*2因为开始时s*=2;
{
printf("YES\n0 0\n%d 0\n0 %d", n2, m2);
printf("YES\n0 0\n%ld 0\n0 %ld", n2, m2);
}
else if (n2 * 2 <= n)
{
printf("YES\n0 0\n%d 0\n0 %d", n2 * 2, m2);
printf("YES\n0 0\n%ld 0\n0 %ld", n2 * 2, m2);
}
else
{
printf("YES\n0 0\n%d 0\n0 %d", n2, m2 * 2);
printf("YES\n0 0\n%ld 0\n0 %ld", n2, m2 * 2);
}
return 0;
}

View File

@ -0,0 +1,2 @@
16904235 79092881 127345237

View File

@ -0,0 +1,4 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
URL=https://vjudge.net/contest/509525

BIN
8.15/A-Intervals/A.pdf (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,14 @@
# Problem A. Intervals
* https://vjudge.net/contest/509525#problem/A
### 题意
数轴上给定n个区间及区间至少要标记的点数每个整数一个点求至少要标记多少个点
### 做法
差分约束
### 关键词
差分约束、最短路、spfa
### 易错点
//n不是点数maxn才是
//漏了最后一个点
in[u]=0;//spfa的精髓 出队与再入队
### 工具箱
* 差分约束、最短路PPT

View File

@ -0,0 +1,12 @@
# 题目
* 链接
### 题意
### 做法
### 关键词
### 易错点
### 工具箱
*

View File

@ -0,0 +1 @@
#

View File

@ -0,0 +1,6 @@
#include <iostream>
using namespace std;
int main()
{
}

View File

View File

View File

View File

@ -0,0 +1,7 @@
## z:\Chao\src\Template\test\in.txt
2020/03/14 ÖÜÁù 11:41:28.68
Hello Easy C++ project!
-----------------------------------------------
Process exited after 200 ms with return value 0

View File

@ -0,0 +1 @@
#

69
8.15/A-Intervals/main.cpp Normal file
View File

@ -0,0 +1,69 @@
#include <iostream>
#include <queue>
#include<cstdio>
#include <string.h>
using namespace std;
const int N=5e4+5,N3=N*4,inf=0x3f3f3f3f; //RE N3=N*4多add()了一轮!
int to[N3],ne[N3],w[N3],h[N],cnt=0,s=N-4,dist[N];
bool in[N];
queue<int>q;
void add(int u,int v,int w1)
{
to[++cnt]=v;
w[cnt]=w1;
ne[cnt]=h[u];
h[u]=cnt;
}
void spfa()
{
q.push(s);
while(!q.empty())
{
int u=q.front();
q.pop();
in[u]=0;//spfa的精髓
for(int i=h[u];i;i=ne[i])
{
int v=to[i],w1=w[i];
// printf("%d %d %d\n",u,v,w1);
if(dist[u]+w1<dist[v])
{
dist[v]=dist[u]+w1;
// printf("%d(%d) %d(%d) %d\n",u,dist[u],v,dist[v],w1);
if(!in[v])
{
q.push(v);
in[v]=1;
}
}
}
}
}
int main()
{
int n,u,v,w1,maxn=0;
scanf("%d",&n);
memset(in,0,sizeof(bool)*(n+1));
for(int i=1;i<=n;i++)
{
scanf("%d%d%d",&u,&v,&w1);
add(v,u-1,w1*-1);
maxn=maxn>u? maxn:u;
maxn=maxn>v? maxn:v;
}
//n不是点数maxn才是
for(int i=0;i<=maxn;i++)
{
dist[i]=inf;
}
for(int i=0;i<maxn;i++)
{
add(i,i+1,1);
add(i+1,i,0);
add(s,i,0);
}
add(s,maxn,0);//漏了
spfa();
printf("%d",dist[maxn]-dist[0]);
return 0;
}

View File

View File

View File

View File

@ -0,0 +1,7 @@
## z:\Chao\src\Template\test\in.txt
2020/03/14 ÖÜÁù 11:41:28.68
Hello Easy C++ project!
-----------------------------------------------
Process exited after 200 ms with return value 0

BIN
8.15/差分约束20220815.pptx (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -10,18 +10,3 @@
### 묏야芎
*
### ÌâÃæ
### Input
### Output
### Sample
#### input
#### output
### Hint
![](sketch.jpg)