Posted 06/17/2016Updated 07/19/2023 Semprathlon / Simfae Dean ACM-ICPC / Programing7 minutes read (About 982 words)2016江南大学ACM俱乐部招新赛匆忙而简捷地办完了年度招新活动,实现了第一次JNUOJ线上赛。 搭建OJ时不能实现预期中的多服务器并行处理,但评测效率已满足需求 VJ始终无法使用,不知原BNUOJ开发者是否会继续维护 命题未免太强调难度了 A. 篱笆和人#include #include #include #include #include #include #include #include #include #include using namespace std; const int N=100005; const int mod=1e9+7; typedef struct node { int x,y; bool operator < (const node &other) const { if(x!=other.x) return y B. Water Problem面向新人的提示:不必使用循环结构…… #include #include #include using namespace std; int main() { long long t; while(scanf("%lld",&t)!=EOF) { if(!(t%2)) { printf("%lld\n",((t/2-1)/2)); } else { printf("0\n"); } } return 0; } C. 交点已知不存在三线交于一点的情况。圆内一个交点就可由两条线段决定,两条线段又由圆上的四个不同点决定。从圆上选取4个点的组合, $ C^4_n = \frac{n(n-1)(n-2)(n-3)}{24}$。另还有圆上的n个点要计算。 T=int(input()) while T>0: T-=1 n=int(input()) print n+n*(n-1)*(n-2)*(n-3)/24 D. 食物处理器#include #include #include #include #include #include #include #include #include #include using namespace std; const int N=100005; const int mod=1e9+7; int val[N]; int main() { int k,n,h,c; long long time=0; while(scanf("%d %d %d",&n,&h,&k)!=EOF) { c=0,time=0; for(int i=1;i<=n;i++) { scanf("%d",&val[i]); } for(int i=1;i<=n;i++) { while(c+val[i]>h) { if(c>k) { int qwe=c; qwe/=k; time+=qwe; c=c%k; } else { c-=k; if(c<0) c=0; time++; } } c+=val[i]; } time+=c/k; if(c%k!=0) { time++; } cout< E. 最大计算值#include #include #include using namespace std; char s[111]; int num[111]; int dp[111][111]; char cal[111]; int calu(int a,int b,char c) { if(c=='*') return a*b; else if(c=='+') return a+b; else if(c=='-') return a-b; } int main() { int T; scanf("%d",&T); for(int i=0;i='0'&&s[i]<='9') { k*=10; k+=s[i]-'0'; i++; } dp[len++][len-1]=k; cal[len-1]=s[i]; } for(int i=2;i<=len;i++) { for(int l=0;l=len)break; for(int k=l;k F. 有趣的字符串#include using namespace std; const int maxn=100005; char s[maxn]; int a[maxn]; int n,k; int work(){ int s=0,t=0,ans=0; int cnt=0; while( s<=t ){ while( cnt<=k &&t 稍暴力些的做法也可: #include using namespace std; const int maxn=100005; char s[maxn]; int a[maxn]; int n,k; int dp[maxn]; int work(){ int ans=0; for(int i=1;i<=n;i++){ for(int j=i;j<=n;j++){ int tmp=dp[j]-dp[i-1]; if(tmp<=k) ans=max(ans,j-i+1); } } return ans; } int main() { int t; scanf("%d",&t); while(t--){ scanf("%d%d",&n,&k); scanf("%s",s); //cout<<"haha"< G. 我的世界/** Sep 19, 2015 7:12:36 PM * PrjName:Bc56-01 * @author Semprathlon */ import java.io.*; import java.util.*; public class Main { /** * @param args */ final static int maxn=110; static int cnt; static int[] w; static HashMap mp=new HashMap(); public static void main(String[] args){ // TODO Auto-generated method stub Scanner in=new Scanner(System.in); PrintWriter out=new PrintWriter(System.out); int T=in.nextInt(); //h=new int[maxn]; w=new int[maxn]; while(T-->0){ int n=in.nextInt(); cnt=0; mp.clear(); Arrays.fill(w, 0); for(int i=1;i<=n;i++){ int k=in.nextInt(); if (mp.containsKey(k)) w[mp.get(k)]+=in.nextInt(); else{ w[cnt]+=in.nextInt(); mp.put(k, cnt++); } } int sum=0; for(int i=0;i H. 尼古拉斯和数组#include #include #include #include #include using namespace std; const int maxn=105; int num[maxn]; int main() { int n; while(~scanf("%d",&n)) { memset(num,0,sizeof(num)); for(int i=1;i<=n;i++) { scanf("%d",&num[i]); } int minpos=0; int maxpos=0; for(int i=1;i<=n;i++) { if(num[i]==1) { minpos=i; } if(num[i]==n) { maxpos=i; } } int len=0; len=abs(maxpos-minpos); int ans=0; if(len==n-1) { ans=n-1; } else { ans=max(ans,abs(maxpos-1)); ans=max(ans,abs(n-maxpos)); ans=max(ans,abs(minpos-1)); ans=max(ans,abs(minpos-n)); } cout << ans << endl; } return 0; } I. 奇妙的&操作#include #include #include #include #include using namespace std; typedef long long ll; const ll mod=1000000007; char s[111111]; int cal(int num) { int res=6; for(int i=0; i<6; i++) if((1<='0'&&s[i]<='9') num=s[i]-'0'; else if(s[i]>='a'&&s[i]<='z') num=s[i]-'a'+36; else if(s[i]>='A'&&s[i]<='Z') num=s[i]-'A'+10; else if(s[i]=='-') num=62; else num=63; int k=cal(num); while(k--) { ans*=3; ans%=mod; } ans%=mod; } //cout< J. 推箱子【题意存疑】怎样在单个地读入字符时排除换行符的影响? #include #include #include #include #include using namespace std; int main() { char y,x; int n; while(scanf(" %c ",&y)!=EOF) { scanf("%d",&n); if(n&1) { if(y=='A') printf("B\n"); else printf("A\n"); } else { printf("%c\n",y); } } return 0; }
Posted 03/19/2016Updated 07/19/2023 Semprathlon / Simfae Dean ACM-ICPC / Programing3 minutes read (About 491 words)BestCoder 已解决题目列表 [King’s Cake][1] [King’s Phone][2] [King’s Order][3] [King’s Game][1] Read more
Posted 02/15/2016Updated 07/19/2023 Semprathlon / Simfae Dean ACM-ICPC / Programing3 minutes read (About 455 words)BestCoder 已解决题目列表 [Clarke and chemistry][1] [Clarke and points][2] Read more
Posted 09/19/2015Updated 07/19/2023 Semprathlon / Simfae Dean ACM-ICPC / Programing2 minutes read (About 249 words)BestCoder1001 Clarke and minecraft玩过MC无压力 123456789101112131415161718192021222324252627282930313233343536373839404142434445/** Sep 19, 2015 7:12:36 PM * PrjName:Bc56-01 * @author Semprathlon */import java.io.*;import java.util.*;public class Main { /** * @param args */ final static int maxn=110; static int cnt; static int[] w; static HashMap<Integer, Integer> mp=new HashMap<Integer,Integer>(); public static void main(String[] args) throws IOException{ // TODO Auto-generated method stub InputReader in=new InputReader(System.in); PrintWriter out=new PrintWriter(System.out); int T=in.nextInt(); //h=new int[maxn]; w=new int[maxn]; while(T-->0){ int n=in.nextInt(); cnt=0; mp.clear(); Arrays.fill(w, 0); for(int i=1;i<=n;i++){ int k=in.nextInt(); if (mp.containsKey(k)) w[mp.get(k)]+=in.nextInt(); else{ w[cnt]+=in.nextInt(); mp.put(k, cnt++); } } int sum=0; for(int i=0;i<cnt;i++) sum+=(w[i]+63)/64; out.println((sum+35)/36); } out.flush(); out.close(); }} 1002 Clarke and problem第一时间想到的是容斥,而后才逐渐醒悟过来是DP。。。另外mod的遗漏又错了一发。。。 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051/** Sep 19, 2015 7:24:54 PM * PrjName:Bc56-02 * @author Semprathlon */import java.io.*;import java.util.*;public class Main { /** * @param args */ final static int maxn=1010; final static int high=1000000000; final static int mod=1000000007; //static int[] s=new int[maxn]; static int[][] f=new int[2][maxn]; public static void main(String[] args) throws IOException{ // TODO Auto-generated method stub InputReader in=new InputReader(System.in); PrintWriter out=new PrintWriter(System.out); int T=in.nextInt(); while(T-->0){ int n=in.nextInt(); int p=in.nextInt(); //Arrays.fill(s, 0, p, 0); Arrays.fill(f[0], 0, p, 0); f[0][0]=1; int cnt=0; //for(int j=0;j<p;j++)out.print(f[j]+" ");out.println(); for(int i=1;i<=n;i++){ int k=in.nextInt(); while(k<0) k+=p; k%=p; Arrays.fill(f[cnt^1], 0,p,0); for(int j=0;j<p;j++){ f[cnt^1][(k+j)%p]+=f[cnt][j]; f[cnt^1][(k+j)%p]%=mod; } for(int j=0;j<p;j++){ f[cnt^1][j]+=f[cnt][j]; f[cnt^1][j]%=mod; } cnt^=1; } out.println(f[cnt][0]); } out.flush(); out.close(); }} 1003 Clarke and puzzle没有总结好Nim游戏的规律啊。。。超简单的代码