chessman666666

1971

Eason_
s糖
Pein
wzx0808060886
yxc的小迷妹
xujiangnan1014

haiqiuandwenbin
acwing_go
Harry666

Mandyyyy

CED_2

BlackPanda

u到v有一条权值为w的有向边。

#include<bits/stdc++.h>

#define int long long

using namespace std;

int n,m,s,r;
const int N=4e5+10;
const int INF=0x3f3f3f3f;

typedef pair<int, int> PII;

int h[N], w[N], e[N], ne[N], idx;       // 邻接表存储所有边
int dist[N];        // 存储所有点到s号点的距离
bool st[N];     // 存储每个点的最短距离是否已确定
int cnt;
int g[N];//记录路径

void add(int x, int y, int c)
{
w[idx] = c;
e[idx] = y;
ne[idx] = h[x];
h[x] = idx++;
}

//求s号点到r的最短路径
void dijkstra()
{
for(int i=0;i<=n;i++)
{
dist[i]=1e11;
}
dist[s] = 0;
priority_queue<PII, vector<PII>, greater<PII>> heap;
heap.push({0,s});      // first存储距离，second存储节点编号

while (heap.size())
{
auto t = heap.top();
heap.pop();

int ver = t.second, distance = t.first;

if (st[ver]) continue;
st[ver] = true;

for (int i = h[ver]; i!= -1; i = ne[i])
{
int j = e[i];
if(i==r) break;
if (dist[j] > distance + w[i])
{
dist[j] = distance + w[i];
heap.push({dist[j], j});
g[++cnt]=j;
}
}
}
}

signed main()
{
cin.tie(0);
ios::sync_with_stdio(false);

memset(h, -1, sizeof(h));

cin>>n>>m>>s>>r;
for(int i=1;i<=m;i++)
{
int x,y,z;
cin>>x>>y>>z;
}
dijkstra();

for(int i=1;i<=n;i++)
{
cout<<dist[i]<<" ";
}
cout<<endl;
if(dist[r]>=1e11/2)
{
cout<<-1;
return 0;
}

//输出s到r号点的最短路径
cout<<s<<' ';
for(int i=1;i<=cnt-1;i++)
{
cout<<g[i]<<" ";
}
cout<<r;
}


#include<bits/stdc++.h>

#define int long long

using namespace std;

int n,m,k;

unordered_set<int> hang,lie;

signed main()
{
cin.tie(0);
ios::sync_with_stdio(false);

cin>>n>>m>>k;
while(k--)
{
int op,x;
cin>>op>>x;
if(op==0) hang.insert(x);
else lie.insert(x);
}
int count=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if(hang.count(i)||lie.count(j))
{

}
else
{
count++;
}
}
}
cout<<count<<endl;
}


#include<bits/stdc++.h>

#define int long long

using namespace std;

string a,b;

string get(string a)
{
string s="";
int len=a.size();
for (int i = 1; i<len; i++)
{
if (a[i] % 2 == a[i-1] % 2)
{
s+=max(a[i],a[i-1]);
}
}
return s;
}

signed main()
{
cin.tie(0);
ios::sync_with_stdio(false);

cin>>a>>b;
string sa=get(a),sb=get(b);
cout<<sa<<endl;
if(sa!=sb) cout<<sb<<endl;
}


#include<bits/stdc++.h>

#define int long long

using namespace std;

const int N=20;

int a,b;
int d[N];

signed main()
{
cin.tie(0);
ios::sync_with_stdio(false);

cin>>a>>b;
int f=a+b;

d[1]=1;
for(int i=2;i<=15;i++)
{
d[i]=d[i-1]*i;
}
cout<<d[f];
}


#include<bits/stdc++.h>

#define int long long

using namespace std;

int a,b,c,d;

signed main()
{
cin.tie(0);
ios::sync_with_stdio(false);

cin>>a>>b>>c>>d;
//两个人都进不去
if(a>c&&a>d)
{
cout<<c<<"-N "<<d<<"-N"<<endl;
cout<<"zhang da zai lai ba"<<endl;
return 0;
}
//两个人都可以进但不是必须一起的
else if(a<=c&&a<=d)
{
cout<<c<<"-Y "<<d<<"-Y"<<endl;
cout<<"huan ying ru guan"<<endl;
return 0;
}
//一个人能进一个不能
if(c>=a&&c<b&&d<a)
{
cout<<c<<"-Y "<<d<<"-N"<<endl;
cout<<"1: huan ying ru guan"<<endl;
return 0;
}
if(d>=a&&d<b&&c<a)
{
cout<<c<<"-N "<<d<<"-Y"<<endl;
cout<<"2: huan ying ru guan"<<endl;
return 0;
}
//两个人必须一起进
if(c<a)
{
cout<<c<<"-Y "<<d<<"-Y"<<endl;
cout<<"qing 2 zhao gu hao 1"<<endl;
return 0;
}
if(d<a)
{
cout<<c<<"-Y "<<d<<"-Y"<<endl;
cout<<"qing 1 zhao gu hao 2"<<endl;
return 0;
}
}


#include<bits/stdc++.h>

#define int long long

using namespace std;

int n,m;

signed main()
{
cin.tie(0);
ios::sync_with_stdio(false);

cin >> n>>m;
int ans=n/m;
cout<<ans<<endl;
}


#include<bits/stdc++.h>

#define int long long

using namespace std;

signed main()
{
cin.tie(0);
ios::sync_with_stdio(false);

puts("I'm gonna win! Today!");
puts("2022-04-23");
}


#### java

import java.io.*;
import java.util.*;
import java.math.*;

public class Main{
public static void main(String args[]){
Scanner in=new Scanner(System.in);
long a=in.nextLong(),b=in.nextLong(),n=in.nextLong();
long ans=0;
long c=n%(5*a+2*b);
long k=n/(5*a+2*b);
if(c==0) ans=7*k;
else if(c>0&&c<=a)
{
ans=7*k+1;
}
else if(c>a&&c<=2*a)
{
ans=7*k+2;
}
else if(c>2*a&&c<=3*a)
{
ans=7*k+3;
}
else if(c>3*a&&c<=4*a)
{
ans=7*k+4;
}
else if(c>4*a&&c<=5*a)
{
ans=7*k+5;
}
else if(c>5*a&&c<=5*a+b)
{
ans=7*k+6;
}
else if(c>5*a+b&&c<=5*a+2*b)
{
ans=7*k+7;
}
System.out.print(ans);
}
}