c语言
lianyizhishui
这个作者很懒,什么都没留下…
展开
-
c
#include#include#include int cmp(const void *a,const void *b){ return *(int *)b-*(int *)a;}int x[30000];int y[30000];int b[30000];struct xj{int x1;int y1;int x2;int y2原创 2017-07-16 15:49:02 · 211 阅读 · 0 评论 -
J - 超大型LED显示屏
#include#include#include#include#include #pragma warning(disable:4996)using namespace std;int show[10] = { 6,2,5,5,4,5,6,3,7,6 };int get(int a){ int sum = 0; if (a == 0) retur原创 2017-08-07 11:51:41 · 167 阅读 · 0 评论 -
H - Hard to Play
#include#include#include#include#include #pragma warning(disable:4996)using namespace std;int main(){int t;scanf("%d", &t);while (t--){int x, y, z,i;int sum1 = 0,sum2=0;s原创 2017-07-27 16:56:07 · 219 阅读 · 0 评论 -
C - Code Formatter
这是水题,注意的是空格只有最后才算的,中间出现的空格都不算#include#include#include#include#include #pragma warning(disable:4996)using namespace std;char s[1010];int main(){ int t; scanf("%d", &t); getcha原创 2017-08-04 19:31:19 · 215 阅读 · 0 评论 -
C语言
素数对Description输入一个正整数n,求有几对素数x,y,满足n=x+y((3,2)和(2,3)视为相同的素数对)。Input有多组数据,每行输入一个偶整数n(3<n<32768)。n等于0时,输入结束。Output输出相应的答案。Sample Input610120Sample Output121用平常方法肯定超时,最好用筛法,看了百度和他人代码瞬间开窍了。。。翻译 2017-07-18 17:12:49 · 161 阅读 · 0 评论 -
c水题,但是坑很细!很深!看了百度才理解的
A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. Given A, B, and n, you are to calculate the value of f(n).原创 2017-07-17 20:14:26 · 241 阅读 · 0 评论 -
acm水题,颜色气球
#include#include#include#include struct Color{char s[100];}color[1010];int main(){int n;while(~scanf("%d",&n)&&n){int i,j,t=0;char a[100];int b[1010],max=0;memset(b,0,s原创 2017-07-17 16:40:23 · 984 阅读 · 0 评论 -
B - 排序 HDU - 1106
#include#include#includetypedef struct student{char xh[100];int sum;}student;student stu[1010];int comp(const void*a,const void*b){student *p=(student*)a; student *q=(stud原创 2017-07-20 18:24:40 · 169 阅读 · 0 评论 -
c
一个整数,只知道前几位,不知道末二位,被另一个整数除尽了,那么该数的末二位该是什么呢?Input输入数据有若干组,每组数据包含二个整数a,b(0<a<10000, 10<b<100),若遇到0 0则处理结束。Output对应每组数据,将满足条件的所有尾数在一行内输出,格式见样本输出。同组数据的输出,其每个尾数之间空一格,行末没有空格。Sample Input200 401992 950 0Sample Output00 40 8015原创 2017-07-17 10:20:36 · 189 阅读 · 0 评论 -
CSU 1350 To Add Which?
这题我的思路是先找到序列中最大的值,然后改变它两边邻居的值,用sum加起来,然后利用二分知识,在找左边和右边的最大值,然后也是改变它们两边邻居的值,如此直到序列最小和它邻居的值符合题意。需要注意的是边界问题,还有处理好序列的两头!#include <iostream>#include <stdio.h>#include <stdlib.h>#incl...原创 2018-08-16 20:12:21 · 160 阅读 · 0 评论