1445 A 求n个整数的和
  1564 B 判断一个数是否是完全数
  1011 C 判素数(Prime number)
  1566 D 输入一组整数,找出最小值
  1200 E 判断三角形是否为直角三角形
  1508 F 袋子里有多少个球(一般情况)
  1139 G 叙拉古猜想
  1135 H 阿姆斯特朗数(Armstrong number)
  1031 I 求阶乘和(the sum of Factorial)
  1402 J 数字根(Digital Roots)
  1567 K 拆分数字并从低位到高位输出
  1565 L 十进制数转二进制从低位到高位输出
Problem A
求n个整数的和
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

先输入一个正整数n,再输入n个整数,求它们的和。
输入:

先输入一个正整数n,再输入n个正整数,

输出:

输出它们的和

输入样例:

输出样例:

Problem A 求n个整数的和

#include <iostream>
using namespace std;

int main()
{
    int n;
    while(cin>>n)
    {
        ;
        int temp;
        ; i<n; i++)
        {
            cin>>temp;
            sum += temp;
        }
        cout<<sum<<endl;
    }

    ;
}

代码A

Problem B
判断一个数是否是完全数
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

如果一个大于2的整数的不包含它自身的约数之和恰好等于它本身,则称其为完全数。如:=++,所以,6是个完全数。
Perfect number is defined as follows:the sum of it’s common divisor which does not includes it’s maximum equals itself.

输入:

输入一个大于2的整数n,

输出:

编程判断n是不是完全数,如果是输出“Yes”,否则输出“No”。

输入样例:

输出样例:

Yes

Problem B 判断一个数是否是完全数

#include <iostream>
using namespace std;

int main()
{
    int n;
    while(cin>>n)
    {
        ;
        ; i<n; i++)
        {
            )
                sum += i;
        }
        if(sum == n)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }

    ;
}

代码B

Problem C
判素数(Prime number)
时限:100ms 内存限制:10000K 总时限:1000ms
描述:

给出一个数n(<=n<=),判定它是否为素数。
素数:一个大于等于2的数,除了1和它本身,再没有其他的整数能将其整除的数叫素数。
Input a number n(<=n<=), judge if it is a prime number.

输入:

从标准输入输入一个整数。
Input a number n(<=n<=)

输出:

若给定数为素数,向标准输出输出“Yes”,否则,输出“No”。
If the number is a prime, output “Yes”. Otherwise, output “No”.

输入样例:

输出样例:

Yes

Problem C 判素数(Prime number)

#include <iostream>
#include<stdio.h>
using namespace std;

int main()
{
    int n;

    while(cin>>n)
    {
        ;
        ; i<=n/; i++)
        {
            )
            {
                flag = ;
                break;
            }
        }
        if(flag)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    ;
}

代码C

 
Problem D
输入一组整数,找出最小值
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

先输入一个正整数n,然后输入n个整数,输出其最小值。

输入:

先输入一个正整数n,然后输入n个整数。

输出:

输出其最小值(最后输出一个回车)。

输入样例:

输出样例:

Problem D 输入一组整数,找出最小值

 #include <iostream>
 #include<stdio.h>
 using namespace std;

 int main()
 {
     int n;
     while(cin>>n)
     {
         ;
         int temp;
         ; i<n; ++i)
         {
             cin>>temp;
             if(temp <= min)
                 min = temp;
         }
         cout<<min<<endl;
     }
     ;
 }

代码D

Problem E
判断三角形是否为直角三角形
时限:100ms 内存限制:10000K 总时限:1000ms
描述:

给定平面直角坐标系中的三个点的坐标,判断是否能构成直角三角形。

输入:

三个点的坐标,数据都在-100000到100000之间。

输出:

一个整数,当可以构成直角三角形的时候输出1,否则输出0。

输入样例:

输出样例:

Problem E 判断三角形是否为直角三角形

 #include <iostream>
 #include<stdio.h>
 using namespace std;

 int main()
 {
     ];
     ; i<; i++)
     {
         cin>>p[i];
     }
     double a,b,c;
     a = (p[]-p[])*(p[]-p[]) + (p[]-p[])*(p[]-p[]);
     b = (p[]-p[])*(p[]-p[]) + (p[]-p[])*(p[]-p[]);
     c = (p[]-p[])*(p[]-p[]) + (p[]-p[])*(p[]-p[]);
     if(a+b==c || a+c==b || b+c == a)
         cout<<<<endl;
     else
         cout<<<<endl;

     ;
 }

代码E

Problem F
袋子里有多少个球(一般情况)
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

袋子里有若干个球的问题,聪明的佳佳很快就算出来了,但是他想写一个程序解决这个问题,并想把问题扩展到一般情况:每次拿出其中的一半再放回去一个球,一共这样做了n次,袋子里还有m个球。问原来袋子中有多少个球?

输入:

输入两个正整数n和m,

输出:

袋子里原来有多少个球

输入样例:

输出样例:

Problem F 袋子里有多少个球(一般情况)

 #include <iostream>
 #include<stdio.h>
 using namespace std;

 int main()
 {

     int n, m;
     cin>>n;
     cin>>m;
     ; i<n; i++)
     {
         m = (m-) * ;
     }
     cout<<m<<endl;
     ;
 }

代码F

Problem G
叙拉古猜想
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

叙拉古猜想又称科拉兹猜想、哈塞猜想、3n+1猜想、乌拉姆猜想或角谷猜想,是指对于每一个大于1的正整数,如果它是奇数,则将其乘3加1,如果它是偶数,则将除以2,如此循环,最终将得到1。
Syracuse conjecture also known  conjecture the Ulam conjecture or angle Valley conjecture, means ,  and plus1, , and so on, will eventually give .

输入:

输入数据包含一个整数N(<N<=)。
Input a positive integer.

输出:

输出数据包含从这个整数到1的按照叙拉古猜想变换的序列,每行一个数字。
Output the sequence in accordance with the Syracuse guess, one per line figures.

输入样例:

输出样例:

Problem G 叙拉古猜想

 #include <iostream>
 #include<stdio.h>
 using namespace std;

 int main()
 {

     int N;
     while(cin>>N)
     {
         cout<<N<<endl;
         )
         {
              == )
                 N /= ;
             else
                 N = N* + ;
             cout<<N<<endl;
         }
     }
 }

代码G

Problem H
阿姆斯特朗数(Armstrong number)
时限:1000ms 内存限制:10000K 总时限:1000ms
描述:

阿姆斯特朗数又称水仙花数,是指一种三位数,其各个数字之立方和等于该数。
Armstrong number which is also called Daffodils number is a three-figure number,and the sum of the number of it’s respective positions equals itself.
For example  = ** + ** + ** 

输入:

本题无输入
None

输出:

升序输出所有阿姆斯特朗数,每个数字占一行。
Output all Armstrong number in ascending order and every integer occupies a line only.

输入样例:

无None
输出样例:

无None

Problem H 阿姆斯特朗数(Armstrong number)

 #include <iostream>
 #include<stdio.h>
 #include<math.h>
 using namespace std;

 int main()
 {
     int a,b,c;
     ; i<; i++)
     {
         a = i/;
         b = (i-a*) / ;
         c = i-a*-b*;
         if(i == a*a*a + b*b*b + c*c*c)
             cout<<i<<endl;
     }
 }

代码H

Problem I
求阶乘和(the sum of Factorial)
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

给你一个正整数n,请你求1到n的阶乘的和,并输出最后结果
如给你5 , 即计算 !+!+!+!+!
Input a positive integer n,and calculate the sum of n!.For example,n  and calculate the following formula:
!+!+!+!+!

输入:

一个正整数n
a positive integer n.

输出:

求得的阶乘和
The sum of n!

输入样例:

输出样例:

Problem I 求阶乘和(the sum of Factorial)

 #include <iostream>
 using namespace std;

 int main()
 {
     int n;
     while(cin>>n)
     {
         ;
         int temp;
         ; i<=n; i++)
         {
             temp = ;
             ; j<=i; j++)
                 temp *= j;
             sum += temp;
         }
         cout<<sum<<endl;
     }
 }

代码I

Problem J
数字根(Digital Roots)
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

一个正整数的数字根是指该数字各位数字之和,如果和是一个个位数,那么这个数字就是它的数字根,如果和是个两位或多于两位的数字,那么就继续求和直到得到个位数。
例如:数字24,把2和4相加,得到6,那么6就是24的数字根;又比如数字39,把数字3和9相加,得到12,因为12时是两位数,所以继续把1和2相加,得到3,于是3就是39的数字根。
The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits, those digits are summed and the process is repeated. This is continued as long as necessary to obtain a single digit.
For example, consider the positive integer . Adding the  and the  yields a value of . Since   . Now consider the positive integer . Adding the  and the  yields . Since   and the  yeilds , a single digit and also the digital root of .

输入:

输入一个正整数,
input a positive integer,

输出:

输出它的数字根。
Output its digital root.

输入样例:

输出样例:

Problem J 数字根(Digital Roots)

 #include <iostream>
 using namespace std;

 int main()
 {
     int n;
     while(cin>>n)
     {
         int temp;
         ;
         while(n)
         {
             temp = n%;
             n /= ;
             sum += temp;
         }
         )
             cout<<sum<<endl;
         else
         {
             int temp2,temp3;
             )
             {
                 temp2 = sum;
                 sum = ;
                 while(temp2)
                 {
                     temp3 = temp2%;
                     temp2 /= ;
                     sum += temp3;
                 }
             }
             cout<<sum<<endl;
         }
     }
 }

代码J

Problem K
拆分数字并从低位到高位输出
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

输入一个正整数,将其各个位上的数字按从低位到高位的顺序单独输出,每个数字占一行。提示可用两种除法/和%,用于整数时第一种除法的结果是商的整数部分,第二种除法的结果是余数,例如:/=,%=)

输入:

一个正整数。

输出:

将其各个位上的数字按从低位到高位的顺序单独输出,每个数字占一行。

输入样例:

输出样例:

Problem K 拆分数字并从低位到高位输出

 #include <iostream>
 using namespace std;
 void swap(int *p,int *p2);
 int main()
 {
     int n;
     ];
     while(cin>>n)
     {
         ;
         while(n)
         {
             num[i] = n % ;
             n /= ;
             i++;
         }
         ; j<i; j++)
         {
             cout<<num[j]<<endl;
         }
     }
 }

代码K

Problem L
十进制数转二进制从低位到高位输出
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

输入一个十进制数,把它转成二进制数后,从低位到高位输出。

输入:

一个十进制数n。

输出:

把n转化为二进制数以后,从地位到高位输出(每个数字占一行)。

输入样例:

输出样例:

Problem L 十进制数转二进制从低位到高位输出

 #include <iostream>
 using namespace std;
 void swap(int *p,int *p2);
 int main()
 {
     int n;
     while(cin>>n)
     {
         ];
         ;
         while(n)
         {
             b[i] = n % ;
             n /= ;
             i++;
         }
         ; j<i; j++)
         {
             cout<<b[j]<<endl;
         }
     }
 }

代码L

Noj - 在线强化训练1的更多相关文章

  1. Noj - 在线强化训练3

    状态 题号 竞赛题号 标题   1091 A 求解逆波兰表达式(Calculate the reverse Polish notation)   1017 B 数列   1323 C 穷举n位二进制数 ...

  2. Noj - 在线强化训练4

    状态 题号 竞赛题号 标题 × 1092 A 童年的回忆——计算24 × 1145 B 求图像的周长 × 1144 C 农场灌溉问题 × 1202 D 数独游戏 × 1243 E 循环赛日程表 × 1 ...

  3. Noj - 在线强化训练2

    状态 题号 竞赛题号 标题   1572 A 九鼎之尊(一)   1573 B 九鼎之尊(二)   1453 C 筛法(Sieve Method)   1134 D 亲密数(close numbers ...

  4. Hinton胶囊网络后最新研究:用“在线蒸馏”训练大规模分布式神经网络

    Hinton胶囊网络后最新研究:用“在线蒸馏”训练大规模分布式神经网络 朱晓霞发表于目标检测和深度学习订阅 457 广告关闭 11.11 智慧上云 云服务器企业新用户优先购,享双11同等价格 立即抢购 ...

  5. Android:JNI强化训练

    一.前言 Java本机接口(Java Native Interface (JNI))是本机编程接口,它是JDK的一部分,JNI它提供了若干的API,实现了和Java和其他通信(主要是C&C++ ...

  6. Python强化训练笔记(七)——使用deque队列以及将对象保存为文件

    collections模块中的deque对象是一个队列,它有着正常队列的先进先出原则.我们可以利用这个对象来实现数据的保存功能. 例如,现有一个猜数字大小的游戏,系统开始会随机roll点一个0-100 ...

  7. Python强化训练笔记(六)——让字典保持有序性

    python的字典是一个非常方便的数据结构,使用它我们可以轻易的根据姓名(键)来找到他的成绩,排名等(值),而不用去遍历整个数据集. 例如:{'Lee': [1, 100], 'Jane': [2, ...

  8. Python强化训练笔记(五)——找出多个字典中的公共键

    在这个问题中,我们期望得到的结果是找到这三轮比赛中,每轮都进球的球员都有谁.下面用python来模拟一下,先生成一批数据: >>> from random import randin ...

  9. ACM: 强化训练-Beautiful People-最长递增子序列变形-DP

    199. Beautiful People time limit per test: 0.25 sec. memory limit per test: 65536 KB input: standard ...

随机推荐

  1. swift 实践- 06 -- UITextView

    import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoa ...

  2. 信息摘要算法之七:SHA在区块链中的应用

    最近几年比特币的火爆带动了人们对区块链技术的研究.当然我们在这里并不讨论区块链技术本身,而是讨论一下区块链中的SHA算法的应用.对于SHA系列算法我们已经在前面作了说明,在这里也不再重复. 1.区块链 ...

  3. pytorch中的 requires_grad和volatile

    https://blog.csdn.net/u012436149/article/details/66971822 简单总结其用途 (1)requires_grad=Fasle时不需要更新梯度, 适用 ...

  4. android 使用opencv

    1.将已有的项目名称改名字,但一直报错 Error:A problem occurred configuring project ':app'.> executing external nati ...

  5. package.json包描述文件说明

    //commonjs包规范-说明 { "name": "leyi",//包名,不允许空格 "description": "hell ...

  6. Web Penetration Testing w3af fierce

    1.启动wsaf工具,设置载入插件(攻击模型的插件),可以设置默认的攻击模型,也可以添加自己的plug. 2.在侦查的时候渗透邮箱需要知道,云行邮箱服务的托管服务器是什么类型,在之前的博客中我已近两提 ...

  7. bzoj 3129

    非常好的一道数学题,考察了大量数论和组合数学的知识 在做本题之前强烈建议先完成下列两个背景知识: ①: bzoj 2142礼物 因为本题的一部分数据需要利用到拓展卢卡斯定理,而礼物是拓展卢卡斯定理的裸 ...

  8. 数据库MySql的安装

    1.MySQL概述 MySQL最初是由“MySQL AB公司”开发的一套关系型数据库管理系统(RDBMS-Relation DataBase Management System).MySQL不仅是最流 ...

  9. Axure-----三级下拉菜单的具体实现过程

    ********三级下拉菜单的动画效果:********** 1.选中三级菜单将其转换为动态面板,命名为treePanel,并隐藏. 2.选中二级菜单添加交互效果:[切换可见性],勾选treePane ...

  10. gitlab原理

    GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务. 其实,说直白点写,他就是个git服务器,和github差不多,只不过,这个gitlab可 ...