f = f * i

代码:

long f = 1;

for(int i = 1 ; i < 5 ; i ++){

System.out.println(f = f*i);

之前一直以为f 的值是固定的1,后来测试才发现,f 的值随着f*i的变化而变化。

时间: 2024-11-10 05:50:52

f = f * i的相关文章

F(x)

F(x) Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description For a decimal number x with n digits (AnAn-1An-2 ... A2A1), we define its weight as F(x) = An * 2n-1 + An-1 * 2n-2 + ... + A2 * 2 + A1 * 1. No

【tail -f db.txt命令是的程序】_练习

一.做出相当于linux系统中 tail -f db.txt命令是的程序 #!/usr/bin/python # -*- coding:utf-8 -*- # Author:zhaosj import time f1 = open('zhaosj.txt','w',encoding='utf-8') # 以'w'模式打开zhaosj.txt文件,赋值给f1 with open('zhaosj.txt','r',encoding='utf-8') as f: # 以'r'模式打开zhaosj.tx

F - Many Moves

F - Many Moves Time limit : 2sec / Memory limit : 256MB Score : 900 points Problem Statement There are N squares in a row. The squares are numbered 1,2,…,N from left to right. You have two pieces, initially placed on square A and B, respectively. You

tail -f a.txt | grep &#39;python&#39;

# tail -f a.txt |grep 'python' #tail -f a.txt import time def tail(conf): with open(conf,encoding='utf-8') as f: f.seek(0,2) while True: f1 = f.readline().strip() if f1: yield f1 else: time.sleep(0.5) # t = tail('a.txt') # print(next(t)) # for line i

F - City Game

F - City Game Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Bob is a strategy game programming specialist. In his new city building game the gaming environmentis as follows: a city is built up by areas, in which there are str

(中等) Hiho 1232 Couple Trees(15年北京网络赛F题),主席树+树链剖分。

"Couple Trees" are two trees, a husband tree and a wife tree. They are named because they look like a couple leaning on each other. They share a same root, and their branches are intertwined. In China, many lovers go to the couple trees. Under t

ACdream原创群赛(13)のwuyiqi退役专场 F The Arrow

F 首先是要理解概率求期望这种题目是用递归来解的! 大概规律就是: 完成事件A的期望是Ea,一次完成的概率是pa,那么 Ea = pa * Ea + (1 + Ea) * (1 - pa) 如果有好多种可能,比方说完成一个事件A的同时,也有诸如事件B的概率期望pb,Eb,事件C的概率期望pc,Ec等等等等,那么就分别写出来: Ea = pa * Ea + (1 + Ea) * (~pa) + pb * (1 + Eb) + pc * (1 + Ec) + ... 其中~pa是除了这些已知的事件发

16级第三周寒假作业F题

Sliding Window TimeLimit:12000MS  MemoryLimit:65536K 64-bit integer IO format:%lld Problem Description Case Time Limit: 5000MS An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left of the arr

[django]django-orm中F对象的使用

django-orm中F对象的使用 前言 django文档中有一节是 Query-related classes,说 的是关联查询,1.7新加上去的,这里的关联是字段的关联,而不是表之间的关联. 表关联中主要用的是3个对象 F(), Q(), 和Prefetch(),其中Prefetch是1.7新加入的,其他两个是之前版本就有的.之前有个需求是比较一张表里的两个时间字段,用到过F这个对象,今天再看djangocon的ppt时候又发现了一些新的用法,于是查询了下文档,小结一下. 概念 class