摘要: http://cstest.scu.edu.cn/soj/problem.action?id=42844284: Windy's JobSubmit your solutionDiscuss this problemBest solutionsDescriptionWindy has N jobs, the i-th job will cost Windy Pi seconds to finish it, and will get Vi sense of achievement.Windy want to get at least K sense of achievement, the 阅读全文
posted @ 2013-05-02 15:35 M_cag 阅读(226) 评论(0) 推荐(0) 编辑
摘要: #include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int dx[]={0,1,-1,0};const int dy[]={1,0,0,-1};const int maxn = 25;bool vis[maxn][maxn];char str[maxn][maxn];int n,m;bool ok(int x,int y){ if(x>=0&&x<m&&y>=0&&y<n& 阅读全文
posted @ 2013-03-30 00:06 M_cag 阅读(143) 评论(0) 推荐(0) 编辑
摘要: //题意描述,给你一张最大1500*1500的图,途中的S称为起点,图可以无限延伸,意思是能够将图能够无限平移,最后让你判断,从起点处能否到达无穷远;//思路,如果一个图能从起点到达无穷远,一定能从图的任意一点到达下一张图与原图对应的点。那么代码就很好写了。 1 #include <cstdio> 2 #include <queue> 3 #include <cstring> 4 #include <algorithm> 5 using namespace std; 6 const int maxn = 1505; 7 const int dx[ 阅读全文
posted @ 2013-03-26 13:06 M_cag 阅读(326) 评论(0) 推荐(0) 编辑
摘要: How manyTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 914Accepted Submission(s): 350 Problem DescriptionGive you n ( n < 10000) necklaces ,the length of necklace will not large than 100,tell me How many kinds of necklaces total have.(if two n 阅读全文
posted @ 2013-03-04 21:11 M_cag 阅读(230) 评论(0) 推荐(0) 编辑
摘要: Distributing Ballot BoxesTime Limit: 20000/10000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 423Accepted Submission(s): 228 Problem DescriptionToday, besides SWERC'11, another important event is taking place in Spain which rivals it in importance: General Elect 阅读全文
posted @ 2013-02-14 21:13 M_cag 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<iostream> 3 #include<math.h> 4 using namespace std; 5 typedef __int64 ll; 6 int main() 7 { 8 int t,ans; 9 scanf("%d",&t);10 int n;11 ll locb,loca;12 while(t--)13 {14 scanf("%d",&n);15 locb = ceil(sqrt(2*(double)n+0.25)-0.5) 阅读全文
posted @ 2012-11-22 21:48 M_cag 阅读(191) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<string.h>const int mod = 9973;#define maxn 15struct matrix{ int arr[maxn][maxn];};matrix mul(struct matrix a,struct matrix b,int n){ int i,j,k,temp; struct matrix val; for(i=1;i<=n;i++) for(j=1;j<=n;j++) { for(k=1,temp=0;k<=n;k++) ... 阅读全文
posted @ 2012-11-21 17:16 M_cag 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 1 import java.io.*; 2 import java.text.*; 3 import java.math.*; 4 import java.util.*; 5 public class Main { 6 7 /** 8 * @param args 9 */10 public static void main(String[] args) {11 // TODO 自动生成的方法存根12 Scanner cin = new Scanner(new BufferedInputStream(System.in));... 阅读全文
posted @ 2012-11-15 14:51 M_cag 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 北师大ACM新手指导第十二题-高精度乘法应用Time Limit: 1000 ms Case Time Limit: 1000 ms Memory Limit: 65536 KBSubmit: 150 Accepted: 54 [Prev][Next]Description正式比赛时,高精度乘法的题目一般都有较大的变形,选手应该充分理解高精度的算法,然后对应不同的题目,对代码作相应的修改,以下是一道正式的ACM高精度题,它可以算作一道比较典型的ACM题目:1、虽然有现成的算法,却无法直接套用,必须根据题目作相应的变型。2、数据有一定的陷阱,要考虑到各种特殊的情况。好,让我们一起努力把这道... 阅读全文
posted @ 2012-11-14 19:05 M_cag 阅读(566) 评论(0) 推荐(0) 编辑
摘要: import java.io.*;import java.math.*;import java.util.*;public class Main { /** * @param args */ public static void main(String[] args) { // TODO 自动生成的方法存根 Scanner cin = new Scanner(new BufferedInputStream(System.in)); int n,num; n = cin.nextInt(); BigInteger a,b,ans; for(int i=1 ;i<=n;i++){ ... 阅读全文
posted @ 2012-11-14 16:13 M_cag 阅读(256) 评论(0) 推荐(0) 编辑