数学 FZU 2074 Number of methods

题目传送门

 1 /*
 2     数学:假设取了第i个,有C(n-1)(i-1)种取法
 3         则ans = sum (C(n-1)(i-1)) (1<i<=n) 即2^(n-1)
 4 */
 5 #include <cstdio>
 6 #include <algorithm>
 7 #include <cstring>
 8 #include <cmath>
 9 using namespace std;
10
11 typedef long long ll;
12 const int MAXN = 1e4 + 10;
13 const int INF = 0x3f3f3f3f;
14 const int MOD = 1000000007;
15
16 int main(void)        //FZU 2074 Number of methods
17     int n;
18     while (scanf ("%d", &n) == 1)
19     {
20         ll sum = 1;
21         for (int i=1; i<n; ++i)
22         {
23             sum = sum * 2 % MOD;
24         }
25         printf ("%I64d\n", sum);
26     }
27
28     return 0;
29 }
时间: 2024-11-08 22:07:32

数学 FZU 2074 Number of methods的相关文章

LeetCode之“数学”:Happy Number

题目链接 题目要求: Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the proces

[水+数学] fzu oj 2193 So Hard and 2191 完美的数字

2193 So Hard 题意: 化简小数. 思路: 最多不超过9位,那么乘以10^9就好了. 然后注意的就是加一下精度. 代码: #include"cstdlib" #include"cstdio" #include"cstring" #include"cmath" #include"queue" #include"algorithm" #include"iostream&q

FZU 2297 Number theory【线段树/单点更新/思维】

Given a integers x = 1, you have to apply Q (Q ≤ 100000) operations: Multiply, Divide. Input First line of the input file contains an integer T(0 < T ≤ 10) that indicates how many cases of inputs are there. The description of each case is given below

methods 方法选项

最简单的使用方法,一个数字,每点击一下按钮加1 html <div id="app"> <span v-text="number"></span> <button @click="add()">add</button> </div> js var vm = new Vue({ el:"#app", data:{ number:1 }, methods:{

图神经网络小结

图神经网络小结 图神经网络小结 图神经网络分类 GCN: 由谱方法到空域方法 GCN概述 GCN的输出机制 GCN的不同方法 基于谱方法的GCN 初始 切比雪夫K阶截断: ChebNet 一阶ChebNet 自适应图卷积网络AGCN 谱方法小结 基于空域方法GCN 基于递归的空间GCN(Recurrent-based Spatial GCNs) 图神经网络GNN(特指早期的一种结构) 门控图神经网络(GGNN) 随机稳态嵌入SSE 基于合成的空间GCN(Composition Based Spa

(七)理解angular中的module和injector,即依赖注入

依赖注入(DI)的好处不再赘言,使用过spring框架的都知道.angularjs作为前台js框架,也提供了对DI的支持,这是javascript/jquery不具备的特性.angularjs中与DI相关有angular.module().angular.injector(). $injector.$provide.对于一个DI容器来说,必须具备3个要素:服务的注册.依赖关系的声明.对象的获取.比如spring中,服务的注册是通过xml配置文件的<bean>标签或是注解@Repository.

简单反射练习

主要是: 利用反射对实例进行构造: 以及调用实例的方法: using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Security; using System.Security.Permissions; using System.Security.Policy; using System.Text; using

[HTTP] HTTP Verb

HEAD: HEAD / HTTP/1.1 nc.exmaple.com HEAD is a interesting method, it allow you to get a header of file without get the whole content. It allows you to check whether there is enought empty space to store the response or the cache is still up to date.

Chapter 18 Saving, Loading, and Application State

1. Archiving is one of the most common ways  of persisting model objects on iOS. Archiving an object involves recording all of its properties and saving to the filesystem. Unarchiving recreates the object that from the data. Classes whose instances n