My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a numberN of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This should be one piece…
求奇数分之一序列前N项和 #include <stdio.h> int main() { int denominator, i, n; double item, sum; while (scanf("%d", &n) != EOF) { denominator = 1; sum = 0; for (i = 1; i <= n; i++) { item = 1.0/denominator; sum = sum+item; denominator = denomi…
求奇数的乘积 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 56573 Accepted Submission(s): 36490 Problem Description 给你n个整数,求他们中所有奇数的乘积. Input 输入数据包含多个测试实例,每个测试实例占一行,每行的第一个数为n,表示本组数据一共有n个,接着是n个整数,…
43 [程序 43 求奇数个数] 题目:求 0—7 所能组成的奇数个数. package cskaoyan; public class cskaoyan43 { @org.junit.Test public void odd() { long sum = 4; long s = 4; long i = 0; for (i = 2; i <= 8; i++) { System.out.println((i - 1) + "位数为奇数的个数" + s); if (i <= 2)…
题目:求0—7所能组成的奇数个数,奇数中不包含重复数字. public class Prog43 { public static void main(String[] args) { //0-7能组成的所有不重复的数的最大值是76543210 //0-76543210中所有的奇数个数为76543210/2 String[] s=new String[76543210/2];//定义一个字符串数组存储0-7能组成的所有奇数 int n=0;//定义一个变量为满足条件的奇数计数 int count=…
求平均成绩 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 61842 Accepted Submission(s): 14812 Problem Description 假设一个班有n(n<=50)个学生,每人考m(m<=5)门课,求每个学生的平均成绩和每门课的平均成绩,并输出各科成绩均大于等于平均成绩的学生数量. Inp…
#include<stdio.h>#include <string.h>int main(){ int n,m; int a[40][40]={0}; scanf("%d",&n); while(n--) { scanf("%d",&m); int i; int j; memset(a,0,sizeof(a)); i=0; j=m/2; int k=1; while(k<=m*m) { if(i<0&&am…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2006 题目大意:给你几个数,求奇数的乘积和 解题思路: 很水,不需要数组的,一个变量 x 就行 代码: #include<iostream> using namespace std; int main() { int sum; int n; ]; while(cin >> n) { sum = ; ; i < n; i ++) { cin >> a[i]; != )…
2000 ASCII码排序 #include <stdio.h> int main(){ char a,b,c,t; while(scanf("%c%c%c", &a, &b, &c)!=EOF){ getchar();#必须得加这玩意 if(a>b){ t = a; a = b; b = t; } if(a>c){ t = a; a = c; c = t; } if(b>c){ t = b; b = c; c = t; } pr…