![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++入门
锦衣月望
这个作者很懒,什么都没留下…
展开
-
立方问题(有关pow)
Description求给定数的立方Input给出一个整数N,N<=10000Output如样例样例输入2输出8As we know,n的立方,就是nnn因为n最大是10000,那么 它的立方就已经超过了int范围,要用long long#include<bits/stdc++.h>using namespace std;int n;int main(){ cin>>n; long long ans=n*n*n; cout原创 2020-07-29 10:47:25 · 335 阅读 · 0 评论 -
八皇后问题(for循环与dfs)
Description相信大家都听过经典的"八皇后"问题吧?这个游戏要求在一个8×8的棋盘上放置8个皇后,使8个皇后互相不攻击(攻击的含义是有两个皇后在同一行或同一列或同一对角线上)。桐桐对这个游戏很感兴趣,现在他想知道每种合法的摆放方案.Input无Output输出若干行,每行一个种方案,也就是8个数字,中间不要用空格分开这个题可以用暴力枚举做#include<bits/stdc++.h>using namespace std;int main(){ for(i原创 2020-06-26 21:41:24 · 615 阅读 · 0 评论 -
for循环之斐波拉契数列
题目大意:菲波那契数列是指这样的数列: 数列的第一个和第二个数都为1,接下来每个数都等于前面2个数之和。给出一个正整数k,要求菲波那契数列中第k个数是多少。Input输入一行,包含一个正整数k。(1 <= k <= 46)Output输出一行,包含一个正整数,表示菲波那契数列中第k个数的大小Sample Input19Sample Output4181这个题我们可以看见它并不难,一个for循环轻松过掉#include<bits/stdc++.h>using原创 2020-06-25 10:14:48 · 7442 阅读 · 3 评论 -
又是一个智障题:hello world
题目大意:用一行输出 “hello world”呵呵#include <bits/stdc++.h>using namespace std; int main(){ cout<<"hello world"<<endl; return 0; }用printf替换cout#include <bits/stdc++.h>using namespace std; int main(){ printf("hello world\n"原创 2020-06-20 14:37:56 · 160 阅读 · 2 评论