Educational Codeforces Round 11(B)模拟
来源:互联网 发布:社交网络结尾视频 编辑:程序博客网 时间:2024/06/01 08:40
题意:看图就可以了。。不解释了。。。。
题解:我是找了下规律,按照x=(2*n+1),y=1,x++,y++填充数组,输出是只要是<=m的都输出,就是答案啦
#include<cstdio> #include<cstring> #include<cstdlib> #include<cmath> #include<iostream> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #include<string> #include<bitset> #include<utility> #include<functional> #include<iomanip> #include<sstream> #include<ctime> using namespace std;#define N int(1e5) #define inf int(0x3f3f3f3f) #define mod int(1e9+7) typedef long long LL; int ans[N];int main(){#ifdef CDZSC freopen("i.txt", "r", stdin);//freopen("o.txt","w",stdout); int _time_jc = clock();#endif int n, m;while (~scanf("%d%d", &n, &m)){int fst = 2 * n + 1;int sec = 1;memset(ans, 0, sizeof(ans));for (int i = 1; i <= n * 4; i+=2){ans[i] = fst++;ans[i + 1] = sec++;}for (int i = 1; i <= 4 * n; i++){if (ans[i] <= m){printf("%d ", ans[i]);}}puts("");}return 0;}
0 0
- Educational Codeforces Round 11(B)模拟
- Educational Codeforces Round 6 (B)模拟
- Educational Codeforces Round 7(B)模拟
- Codeforces - Educational Codeforces Round 14B - s-palindrome(模拟)
- Educational Codeforces Round 7-B. The Time(模拟)
- Educational Codeforces Round 12(B)暴力模拟
- Educational Codeforces Round 32 B. Buggy Robot(模拟)
- Educational Codeforces Round 10(A)模拟
- Educational Codeforces Round 1(B)
- Educational Codeforces Round 5(B)贪心
- Educational Codeforces Round 30(A+B)
- Educational Codeforces Round 1 B.Queries on a String(模拟)
- Educational Codeforces Round 6 B. Grandfather Dovlet’s calculator(模拟)
- Educational Codeforces Round 6-B. Grandfather Dovlet’s calculator(简单模拟)
- Educational Codeforces Round 27 B. Luba And The Ticket(模拟)
- Educational Codeforces Round 5 B
- Educational Codeforces Round 3 B
- Educational Codeforces Round 20 B
- 自定义View______绘制圆盘
- [IO]——处理流
- manacher算法-最长子回文串
- 开发问题记录之Cookie
- x86汇编--(七)高仿for循环嵌套打印字符串
- Educational Codeforces Round 11(B)模拟
- KMP算法
- Win7 64b的VS2015 如何使用nmake成功编译detour express 3.0-error2202 警告被视为错误 - 没有生成“object”文件
- [IO]——处理流.字节数组
- php foreach嵌套的坑
- python:正确的对未知编码的字符串进行预处理-Unicode-UTF8-gbk
- LeetCode 63. Unique Paths II
- UserDefault
- 1011. World Cup Betting