Gym - 100801H Hash Code Hacker (构造)
2024-09-06 19:49:26
题意:求 n 个哈希值相同的串。
析:直接构造,通过取模来查找相同的串。
代码如下:
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
#include <cctype>
#include <cmath>
#include <stack>
#include <sstream>
#define debug() puts("++++");
#define gcd(a, b) __gcd(a, b)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define freopenr freopen("in.txt", "r", stdin)
#define freopenw freopen("out.txt", "w", stdout)
using namespace std; typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 1e5 + 50;
const LL mod = 2147483648;
const int dr[] = {-1, 0, 1, 0};
const int dc[] = {0, 1, 0, -1};
const char *de[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
int n, m;
const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
inline bool is_in(int r, int c){
return r >= 0 && r < n && c >= 0 && c < m;
}
vector<string> v, ans; int main(){
freopen("hash.in", "r", stdin);
freopen("hash.out", "w", stdout);
v.push_back("edHs"); v.push_back("fEHs"); v.push_back("edIT");
for(int i = 0; i < 3; ++i) for(int j = 0; j < 3; ++j)
for(int k = 0; k < 3; ++k) for(int l = 0; l < 3; ++l)
for(int o = 0; o < 3; ++o) for(int p = 0; p < 3; ++p)
for(int q = 0; q < 3; ++q) ans.push_back("mENAGeS"+v[i]+v[j]+v[k]+v[l]+v[o]+v[p]+v[q]);
scanf("%d", &n);
for(int i = 0; i < n; ++i) cout << ans[i] << endl;
return 0;
}
最新文章
- 通过lucene的StandardAnalyzer分析器来了解分词
- 【转】CwRsync简介
- android数据存储之SharedPreferences
- Ubuntu 升级内核
- Eclipse @override报错解决 必须覆盖超类方法
- [设计模式]Netd中的命令设计模式
- SGU 113.Nearly prime numbers
- crowd在更改IP后无法登录的问题
- poj 3254 Corn Fields 国家压缩dp
- Javascript_Dom编程 阅读笔记(1)
- SecureCRT中vim乱码问题
- Java学习笔记6(循环和数组练习题)
- 24 GISer必备知识(一) 坐标系
- sublime text3 离线安装插件方法 package control
- odoo开发笔记--form视图自定义
- 再次理解 C# LINQ
- jstat查看JVM GC情况
- 程序员、互联网从业者必读KK三大力作之《必然》总结
- 转发一篇分析LinQ是什么?
- UWP 自然灾害App在刷新数据后卡死的解决方案
热门文章
- 配置springMVC时出现的问题
- 远程访问(post 传参数) 以及IOUtils复制文件
- The goroutine scheduler is not preemptive.
- distributed OSGI demo
- CUDA: 常量内存与事件
- 20145239杜文超 《Java程序设计》第10周学习总结
- 玩转Google开源C++单元测试框架Google Test系列(gtest)(总)
- BZOJ1415 聪聪和可可 —— 期望 记忆化搜索
- LINQ to Entities 不识别方法"System.String ToString()",因此该方法无法转换为存储表达式 的解决方法
- hello vue不显示