C语言
东さん
无知而狂妄
展开
-
关于矩形转换输出格式巧妙方法
关于矩形转换输出格式巧妙方法输出矩形的时候最后一位需要换行 在输出的同时换行#include<stdio.h>int main(){ int a[100][100]; int i, j, m, n; while(scanf("%d %d",&m,&n)!=EOF) { for(i=0; i<=m-1; i++) {原创 2017-03-18 00:22:16 · 534 阅读 · 0 评论 -
CodeForces - 266B - B. Queue at the School
题目连接:http://codeforces.com/problemset/problem/266/B题目描述DescriptionDuring the break the schoolchildren, boys and girls, formed a queue of n people in the canteen. Initially the children stood in the ord原创 2017-07-18 20:34:46 · 621 阅读 · 1 评论 -
CodeForces - 467A - A. George and Accommodation
题目连接:http://codeforces.com/problemset/problem/467/A题目描述DescriptionGeorge has recently entered the BSUCP (Berland State University for Cool Programmers). George has a friend Alex who has also entered th原创 2017-07-18 20:39:35 · 784 阅读 · 0 评论 -
L - The Dole Queue
In a serious attempt to downsize (reduce) the dole queue, The New National Green Labour Rhinoceros Party has decided on the following strategy. Every day all dole applicants will be placed in a large c原创 2017-03-26 14:25:15 · 499 阅读 · 0 评论 -
H - Digit Counting
Trung is bored with his mathematics homeworks. He takes a piece of chalk and starts writing a sequence of consecutive integers starting with 1 to N (1 < N < 10000). After that, he counts the number of原创 2017-03-26 14:19:29 · 239 阅读 · 0 评论 -
I - Box
Ivan works at a factory that produces heavy machinery. He has a simple job — he knocks up wooden boxes of different sizes to pack machinery for delivery to the customers. Each box is a rectangular para原创 2017-03-26 14:21:17 · 525 阅读 · 0 评论 -
G - All in All
You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss原创 2017-03-26 14:17:48 · 256 阅读 · 0 评论 -
F - Molar mass
An organic compound is any member of a large class of chemical compounds whose molecules contain carbon. The molar mass of an organic compound is the mass of one mole of the organic compound. The molar原创 2017-03-26 14:16:01 · 448 阅读 · 0 评论 -
D - Circular Sequence
Some DNA sequences exist in circular forms as in the following figure, which shows a circular sequence“CGAGTCAGCT”, that is, the last symbol “T” in “CGAGTCAGCT” is connected to the first symbol “C”. W原创 2017-03-26 14:13:11 · 336 阅读 · 0 评论 -
C语言背包问题优化
#include<stdio.h> #define V 1500 int f[V]; int weight[10]; int value[10]; #define max(x,y) (x)>(y)?(x):(y) int main() { int N, M; scanf("%d %d", &N, &M); for (int i=1;原创 2017-04-01 21:21:55 · 468 阅读 · 0 评论 -
C语言背包问题
#include<stdio.h> #define V 1500 int f[10][V];int weight[10]; int value[10]; #define max(x,y) (x)>(y)?(x):(y) int main () { int N, M; scanf("%d %d", &N, &M);// N物品个数 M背包容原创 2017-04-01 21:20:59 · 1231 阅读 · 0 评论 -
c语言 背包问题dfs方法
#include<stdio.h> #define N 30 int w[N], value[N], n, maxvalue = 0, V; void dfs(int index, int sumw, int sumv) { if(index > n) { if(sumw <= V && sumv > maxvalue)原创 2017-04-01 21:19:48 · 645 阅读 · 0 评论 -
C语言奶牛的锻炼
描述 Description 奶牛Bessie有N分钟时间跑步,每分钟她可以跑步或者休息。若她在第i分钟跑步,可以跑出D_i米,同时疲倦程度增加1(初始为0)。若她在第i分钟休息,则疲倦程度减少1。无论何时,疲倦程度都不能超过M。另外,一旦她开始休息,只有当疲惫程度减为0时才能重新开始跑步。在第N分钟后,她的疲倦程度必须为0。输入格式 Input Format Bessie想原创 2017-03-18 22:08:16 · 840 阅读 · 0 评论 -
二维数组的初始化
二维数组的初始化1.使用两个for循环定义for(i=1; i<=n; i++){ for(j=1; j<=n; j++) { scanf("%d",&a[n][m]); }}2.定义时初始化int a[n][m]={0};3.使用函数定义 memset:作用是在一段内存块中填充某个给定的值,它是对较大的结构体或数组进行清零操作的一种最快方法原创 2017-03-18 00:14:55 · 932 阅读 · 0 评论 -
C语言从数字n到m有多少的不带4的整数
C语言从数字n到m有多少的不带4的整数#include<stdio.h>#define min(a,b) a>b?b:a#define max(a,b) a>b?a:bint count;int maxn = 1000000;long long a[1000000];int judge(int n){ while(n) { int x = n%10;原创 2017-03-18 21:52:26 · 1447 阅读 · 1 评论