UVA 10127 - Ones
题目链接
题意:求出多少个1组成的数字能整除n
思路:一位位去取模,记录答案即可
代码:
#include
#include
int n;
int main() {
while (~scanf("%d", &n)) {
int ans = 1;
int now = 1;
while (now) {
...
分类:
其他好文 时间:
2014-06-15 15:10:41
阅读次数:
151
package reverseList;public class Main { static void perm(char c[],int lev,char ans[]) { if(c.length==lev) { System.out.println(String.valueOf(ans)); }...
分类:
其他好文 时间:
2014-06-14 20:36:26
阅读次数:
154
点击打开链接
注意到20w条边,但是询问只有1w,所以有很多边是从头到尾不变的。
首先离线处理,将从未删除的边缩点,缩点后的图的点数不会超过2w,对于每一次add或者delete,直接dfs看是否能从a走到b,然后维护一个ans。
数据不强,不然这种复杂度起码要跑10s。。
#include
#include
#include
#include
using namespace std;
#...
分类:
其他好文 时间:
2014-06-14 12:08:22
阅读次数:
224
Uva 11728 - Alternate Task
题目链接
题意:给定一个因子和,求出对应是哪个数字
思路:数字不可能大于因子和,对于每个数字去算出因子和,然后记录下来即可
代码:
#include
#include
const int N = 1005;
int n, ans[N];
void init() {
memset(ans, -1, sizeo...
分类:
其他好文 时间:
2014-06-14 11:59:06
阅读次数:
264
题目:
链接:点击打开链接
题意:
输入n个点,要求选m个点满足连接m个点的m-1条边权值和sum与点的权值和ans最小,即sum/ans最小,并输出所选的m个点,如果有多种情况就选第一个点最小的,如果第一个点也相同就选第二个点最小的........
求一个图中的一颗子树,使得Sum(edge weight)/Sum(point weight)最小~
数据...
分类:
其他好文 时间:
2014-06-14 07:05:34
阅读次数:
350
#include #include int map[51][51][51];int
v[51][51][51];int a,b,c,t11;struct node{ int x,y,z,ans;}q[200001];int
jx[6]={0,0,0,0,-1,1};int jy[6]={0,0...
分类:
其他好文 时间:
2014-06-13 17:10:39
阅读次数:
157
#include#includeusing namespace std;char
c[100],ans[100];int main(){ int len; cin>>len; while(len--) {
cin>>c; int m; cin>>m; int len=strlen(c); int b...
分类:
其他好文 时间:
2014-06-12 07:40:23
阅读次数:
215
数组必须开大点#include #include #include #include using
namespace std;struct node{ int x,ans;}q[1000005];int jx[]={-1,1};int n,k;int
map[1000005],v[100000...
分类:
其他好文 时间:
2014-06-08 20:48:03
阅读次数:
319
大水题……不过通过这题我们应该养成一个好习惯:好好看清题……竟然没有看到时限 10sec…… 1
var i,j,n,m,ans:longint; 2 f,time,x,y:array[0..15000] of longint; 3 function
max(x,y:longint):lon...
分类:
其他好文 时间:
2014-06-08 18:38:49
阅读次数:
261