首页 > TAG信息列表 > 1847

POJ 1847

熟悉下最短路问题,用dijkstra a了,不过一定一定要注意审题 #include <iostream> #include <algorithm> #include <queue> #include <string> #include <vector> #include <cstdio> #include <cstring> #include <cmath> #include <string> #

[LeetCode] 1847. Closest Room

There is a hotel with n rooms. The rooms are represented by a 2D integer array rooms where rooms[i] = [roomIdi, sizei] denotes that there is a room with room number roomIdi and size equal to sizei. Each roomIdi is guaranteed to be unique. You are

51nod 1847 奇怪的数学题(min25)

51nod 1847 奇怪的数学题(min25) http://www.51nod.com/Challenge/Problem.html#problemId=1847 设\(f(n)\)为\(n>1\)的次小约数(\(f(1)=0\)),很显然\(f(n)={n\over {\rm minp} (n)}\),其中\({\rm minp}(n)\)表示n的最小质因数。 原式就变成 \[\sum_i^n\sum_j^n f(\gcd(i,j))^k \]先

POJ - 1847 Tram

POJ - 1847 题目链接 思路 题意比较简单,关键在于如何转化为图的过程。 首先,我们对条件进行分析n最大是100,那么这题极有可能是Floyd 再而,切换开关需要的花费是1,每个开关链接着两个点,这里可以看作是一条边链接两个点。 最后,确定边权值,切换开关边权值是1,不切换开关边权值是0,完成建图

Tram POJ - 1847 spfa

#include<iostream> #include<algorithm> #include<queue> #include<cstdio> #include<cstring> using namespace std; const int N=1100,INF=0x3f3f3f3f; int h[N],e[N],v[N],w[N],ne[N],idx; int dist[N]; bool st[N]; int n,beg,en,ans; vo

新手使用GIT 上传文件到github

手把手教你如何使用 Git # 初始化一个新的Git仓库 1.方式一: mkdir(make directory) test或者直接进入文件夹中再打开git 方式二:cd /文件夹 cd(change directory) c:/文件夹 2.cd test(目录) # pwd 查看操作的目录 # ls 查看当前的所有文件 git init