A

解法:dfs搜索,注意一个剪枝,否则会超时(听说原本是个dp)?

#include<stdio.h>
//#include<bits/stdc++.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<sstream>
#include<set>
#include<queue>
//#include<map>
#include<vector>
#include<algorithm>
#include<limits.h>
#define inf 0x3fffffff
#define INF 0x3f3f3f3f
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define ULL unsigned long long
using namespace std;
int n,m,k,MIN;
int v,u,w;
int i,j;
int map[1100][1100];
void dfs(int s,int num,int sum)
{
if(s==n)
{
MIN=min(sum,MIN);
return ;
}
if(num==k)
return ;
for(int i=1;i<=n;i++)
{
if(map[s][i]!=-1&&sum+map[s][i]<=MIN)
dfs(i,num+1,sum+map[s][i]);
}
}
int main()
{
while(~scanf("%d%d%d",&n,&m,&k))
{
if(n+m+k==0) break;
memset(map,-1,sizeof(map));
for(i=0;i<m;i++)
{
cin>>u>>v>>w;
map[u][v]=map[v][u]=w;
}
MIN=inf;
dfs(1,0,0);
if(MIN==inf)
{
puts("CONTINUE LOL!");
}
else
{
printf("%d\n",MIN);
}
}
return 0;
}

B

解法:模拟,移动数组

#include <stdio.h>
int main()
{
int n,q;
int a[100];
while(~scanf("%d%d",&n,&q)&&(n+q))
{
int xi;
int c=1;
for(int i=1;i<=n;i++)
{
a[i-1]=c;
c++;
}
while(q--)
{
scanf("%d",&xi);
int b=a[xi-1];
for(int i=xi-1;i>=0;i--)
{
a[i]=a[i-1];
}
a[0]=b;
}
for(int i=0;i<n;i++)
{
printf("%d ",a[i]);
}
printf("\n");
}
return 0;
}

C

解法:字符串匹配

#include<stdio.h>
#include<string.h>
int main()
{
char a[100000];
char b[100000];
int n;
while(scanf("%d",&n)!=EOF)
{
while(n--)
{
scanf("%s%s",a,b);
if(strstr(b,a)!=NULL)
printf("YES\n");
else
printf("NO\n");
}
}
}

D

解法:链接:http://blog.csdn.net/ramay7/article/details/50328357

#include <stdio.h>
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
long long u, d, ans, cases = 0,t;
while (~scanf("%lld%lld", &u, &d))
{
if(u==0&&d==0) break;
ans = 0;
while (d)
{
ans += u / d;
t = u%d;
u = d;
d = t;
}
printf("%lld\n", ans);
}
return 0;
}

E

解法:链接http://acm.hdu.edu.cn/showproblem.php?pid=1205

#include <stdio.h>
int a[1000100];
int main()
{
int i,n,t,max;
int sum;
scanf("%d",&t);
while(t--)
{
sum=0;
scanf("%d",&n);
max=-1;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
sum+=a[i];
if(a[i]>max) max=a[i];
}
// printf("%d %d\n",Max,sum);
sum=sum-max+1;
if(sum>=max) printf("Yes\n");
else printf("No\n");
}
return 0;
}

F

解法:模拟

#include <iostream>
#include<stdio.h>
using namespace std;
typedef struct stdust
{
char name[100];
int score;
} hehe; int main ()
{
int n,x,i,sum,zhang,d;
cin>>x;
{
while(x--)
{
cin >> n;
sum=0;
zhang=0;
hehe stdust[n];
for (int i=0; i<n; i++)
cin >> stdust[i].name >> stdust[i].score;
for(int i=0; i<n; i++)
{
if(stdust[i].score<=40)
sum+=1;
if(stdust[i].score>40)
{
if(stdust[i].score%40==0)
d=stdust[i].score/40;
else
d=stdust[i].score/40+1;
sum+=d;
zhang+=3;
} }
cout<<sum<<" "<<zhang<<endl;
}
}
}

G

解法:没有什么好说的

#include<stdio.h>
int main()
{
int n,a,sum;
while(scanf("%d",&n),n)
{
sum=0;
while(n--)
{
scanf("%d",&a);
sum+=a;
}
printf("%d\n",sum);
}
return 0;
}

H

解法:暂无(记忆化搜索??)

2013年江西理工大学C语言程序设计竞赛(高级组)的更多相关文章

  1. 2014江西理工大学C语言程序设计竞赛高级组题解

    1001 Beautiful Palindrome Number 枚举回文数字前半部分,然后判断该数字是否满足,复杂度为O(sqrt(n))! 1002 Recovery Sequence  本题的核 ...

  2. 2017年江西理工大学C语言程序设计竞赛(高级组)

    问题 A: 求近似值 #include <stdio.h> #include <time.h> #include <stdlib.h> using namespac ...

  3. 2018年江西理工大学C语言程序设计竞赛(高级组) 三角平方数

    题目描述 三角数:形如图a,圆点摆放成等边三角形的数字,则为三角数. (图a) 平方数:形如图b,小方块摆放成正方形的数字,则为平方数. (图b) 那么如果一个数字既是三角形数又是平方数,则称为三角平 ...

  4. 2018年江西理工大学C语言程序设计竞赛高级组部分题解

    B Interesting paths 考察范围:组合数学 此题是机器人走方格的变种,n*m的网格,从(1,1)走到(n,m),首先可以明确,水平要走m-1格,竖直要走n-1格,则走到目的地的任意一条 ...

  5. 2018年江西理工大学C语言程序设计竞赛(初级组)一

     C语言竞赛初级组第一.二场答案:https://www.cnblogs.com/xingkongyihao/p/10046918.html  A: 逆序对 时间限制: 1 s      内存限制:  ...

  6. 2013年江西理工大学C语言程序设计竞赛(初级组)

    ACM ICPC WORLD FINAL 解法:排序大家都知道,去重的话,初学者用数组就好了 #include<algorithm> #include<iostream> us ...

  7. 2017年江西理工大学C语言程序设计竞赛(初级组)

    问题 A: Petr的盒子(初) #include <iostream> #include <stdio.h> #include <algorithm> using ...

  8. 2014江西理工大学C语言程序竞赛高级组

    Beautiful Palindrome Number 题意:求N里面有多少个符合要求的数字(数字要求:回文数,且前一半部分是不严格递增) 解法:打表 #include<bits/stdc++. ...

  9. 2016年江西理工大学C语言程序设计竞赛(高级组)

    问题 A: jxust 解法:争议的问题(是输入整行还是输入字符串),这里倾向输入字符串,然后判断是否含有jxust就行 #include<bits/stdc++.h> using nam ...

随机推荐

  1. Centos7 安装 Nginx

    Nginx有很多版本的,下面我给个链接http://nginx.org/packages/mainline/centos/7/x86_64/RPMS/ 下载对应当前系统版本的nginx包(packag ...

  2. Java之Structs框架初探

    今天是小白第一次自己的接触Struts框架,因为网上的资料都是从Structs2开始,跟Structs1完全不同,因此,小白直接跳过1学习版本2的搭建,废话不多说,直接开始. 首先要搭建框架,就肯定要 ...

  3. oracle热备份

    1:热备份: SHUTDOWN IMMEDIATE; STARTUP MOUNT; alter database archivelog; --ALTER SYSTEM SET LOG_ARCHIVE_ ...

  4. 广告点击率 CTR预估中GBDT与LR融合方案

    http://www.cbdio.com/BigData/2015-08/27/content_3750170.htm 1.背景 CTR预估,广告点击率(Click-Through Rate Pred ...

  5. zw版【转发·台湾nvp系列Delphi例程】HALCON SetLineStyle2

    zw版[转发·台湾nvp系列Delphi例程]HALCON SetLineStyle2 procedure TForm1.Button1Click(Sender: TObject);var img : ...

  6. Python for z/OS

    Install pythondev Install DB2 or server driver package easy_install ibm_db Get license file from tor ...

  7. Android SDK Manager更新报错

    错误log: Fetching https://dl-ssl.google.com/android/repository/addons_list-.xml Fetched Add-ons List s ...

  8. CentOS:安装桌面GNOME图形化界面

    u盘安装dvd版的CentOS7后,没有桌面,浏览器也是黑框版的:如果需要桌面的话,下面三条命令即可:但是安装桌面后,系统会没有之前纯净: 1 安装Gnome包: sudo yum groupinst ...

  9. Android 带checkbox的listView 实现多选,全选,反选,删除

    activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android&qu ...

  10. JNI 回调小记

    javah在eclipse中设置参数:location(javah.exe的位置)working dir(${project_loc}/src) -classpath .;./classes -d $ ...