#-*-coding=utf-8-*-
for a in range(1,50,1):
for b in range(1,50,1):
for c in range(1,50,1):
if a+b+c==50:
print a,b,c

如果是随机数咋整??:

test:

#-*-coding=utf-8-*-
import random
i=0 #计数
for a in range(1,50,1):
for b in range(1,50,1):
c=random.randint (1,50)
if a+b+c==50:
i+=1
print a,b,c,i

no.5.print sum的更多相关文章

  1. 43. 动态规划求解n个骰子的点数和出现概率(或次数)[Print sum S probability of N dices]

    [题目] 把N个骰子扔在地上,所有骰子朝上一面的点数之和为S.输入N,打印出S的所有可能的值出现的概率. [分析] 典型的动态规划题目. 设n个骰子的和为s出现的次数记为f(n,s),其中n=[1-N ...

  2. Python3基础 sum,range 计算1到100的和

    镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...

  3. geeksforgeeks@ Find sum of different corresponding bits for all pairs (Bit manipulation)

    http://www.practice.geeksforgeeks.org/problem-page.php?pid=387 Find sum of different corresponding b ...

  4. Large sum

    聪明的办法是想:求前10位,那只要前8位加起来,进2位就OK. 本的办法,就是真的加起来,截前面10位.如我. numList = str.split() sum = 0 for i in range ...

  5. [Swift]LeetCode437. 路径总和 III | Path Sum III

    You are given a binary tree in which each node contains an integer value. Find the number of paths t ...

  6. Codeforces 797B - Odd sum

    B. Odd sum 题目链接:http://codeforces.com/problemset/problem/797/B time limit per test 1 second memory l ...

  7. 1-100求和 sum(range(101))

    print(sum(range(101))) s = 0for i in range(101): s += iprint(s)  

  8. python练习笔记——map | sum | pow 的应用

    1 函数简要 map 函数  | sum 函数  |  pow函数  | lambda函数 2 简要计算 2.1 1^2 + 2^2 + 3^2 .....9^2 方法1 print([pow(x,2 ...

  9. python学习笔记011——内置函数sum()

    1 描述 sum() 方法对系列进行求和计算. 2 语法 sum(iterable[, start]) iterable:可迭代对象,如列表. start:指定相加的参数,如果没有设置这个值,默认为0 ...

随机推荐

  1. UINavigationBar 和 UINavigationItem的属性设置

    #import "RootViewController.h" @interface RootViewController () @end @implementation RootV ...

  2. IOS 沙盒机制 浅析

    IOS中的沙盒机制(SandBox)是一种安全体系,它规定了应用程序只能在为该应用创建的文件夹内读取文件,不可以访问其他地方的内容.所有的非代码文件都保存在这个地方,比如图片.声音.属性列表和文本文件 ...

  3. android 音乐播放器简单实现

    package com.zhangbz.musicplayer; import java.io.File; import android.app.Activity; import android.me ...

  4. iOS网络-01-NSURLRequest与NSURLConnection

    NSURLRequest NSURLRequest封装了一次网络请求所需要的数据,主要封装了以下信息: 请求路径(URL) 请求方法(GET或POST) 请求头 请求体 超时参数 NSURLReque ...

  5. 21分钟 MySQL 入门教程

    目录 一.MySQL的相关概念介绍 二.Windows下MySQL的配置 配置步骤 MySQL服务的启动.停止与卸载 三.MySQL脚本的基本组成 四.MySQL中的数据类型 五.使用MySQL数据库 ...

  6. centos7安装python-pip

    在使用centos7的软件包管理程序yum安装python-pip的时候会报一下错误: No package python-pip available. Error: Nothing to do 说没 ...

  7. Mongo 的相关增删改查

    1,Mongod 下载安装,请看https://www.mongodb.com/download-center 2,插入语句: MongoDB后台管理 Shell 如果你需要进入MongoDB后台管理 ...

  8. c#的序列化与反序列化

    这是反序列化的代码 using System.Runtime.Serialization.Json; public static T deserialize<T>(String s) { ...

  9. jquery获取复选框(checkbox)的选中值(一组和单个)

    使用jquery获取一组或者单个checkbox的选中状态的值.下面通过一个示例进行说明,假设现有一页面有一组checkbox的name的值为id,那么获取这组name=id的checkbox的值的方 ...

  10. [转]Asp.NET MVC Widget开发 - ViewEngine

    本文转自:http://www.cnblogs.com/hsinlu/archive/2011/03/02/1968796.html 在Asp.NET开发博客类系统,我们经常都会用到Widget,像在 ...