IOS-通讯录
一、通讯录简介
用户还没有决定是否授权你的程序进行访问
iOS设备上的家长控制或其它一些许可配置阻止了你的程序与通讯录数据库进行交互
用户明确的拒绝了你的程序对通讯录的访问
用户已经授权给你的程序对通讯录进行访问
// 获得授权状态
ABAuthorizationStatus status = ABAddressBookGetAuthorizationStatus();
三、申请授权
四、获得所有的联系人数据
// 获得所有的联系人
CFArrayRef array = ABAddressBookCopyArrayOfAllPeople(book);
// 联系人的总数
int count = CFArrayGetCount(array);
for (int i = 0; i < count; i++){
// 获得某个联系人
ABRecordRef person = CFArrayGetValueAtIndex(array, i);
}
// 释放
CFRelease(array);
NSArray *array = (__bridge NSArray *) ABAddressBookCopyArrayOfAllPeople(book);
int count = array.count;
for (int i = 0; i < count; i++){
ABRecordRef person = (__bridge ABRecordRef)array[i];
}
五、获得联系人的简单属性
// 获得名
CFStringRef firstName = ABRecordCopyValue(person, kABPersonFirstNameProperty);
// 获得姓
CFStringRef lastName = ABRecordCopyValue(person, kABPersonLastNameProperty);
// 获得名
NSString *firstName = (__bridge NSString *) ABRecordCopyValue(person, kABPersonFirstNameProperty);
// 获得姓
NSString *lastName = (__bridge NSString *) ABRecordCopyValue(person, kABPersonLastNameProperty);
六、获得联系人的复杂属性
ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);
// …….
CFRelease(emails);
int count = ABMultiValueGetCount(emails);
for (int i = 0; i < count; i++){
// 获得标签名
CFStringRef emailLabel = ABMultiValueCopyLabelAtIndex(emails, i);
// 转为本地标签名(能看得懂的标签名,比如work、home)
CFStringRef localizedEmailLabel = ABAddressBookCopyLocalizedLabel(emailLabel);
// 获得邮件地址值
CFStringRef email = ABMultiValueCopyValueAtIndex(emails, i);
NSLog(@"%@-%@:%@", emailLabel, localizedEmailLabel, email);
// 释放
CFRelease(emailLabel);
CFRelease(localizedEmailLabel);
CFRelease(email);
}
// 获得标签名
NSString *emailLabel = (__bridge NSString *)(ABMultiValueCopyLabelAtIndex(emails, i));
// 转为本地标签名(能看得懂的标签名,比如work、home)
NSString *localizedEmailLabel = (__bridge NSString *)(ABAddressBookCopyLocalizedLabel((__bridge CFStringRef)(emailLabel)));
// 获得邮件地址值
NSString *email = (__bridge NSString *)(ABMultiValueCopyValueAtIndex(emails, i));
NSLog(@"%@-%@:%@", emailLabel, localizedEmailLabel, email);
七、添加联系人的步骤
1.添加联系人代码实现
// 创建联系人
ABRecordRef person = ABPersonCreate();
// 设置属性
ABRecordSetValue(person, kABPersonFirstNameProperty, @"明杰", NULL);
ABRecordSetValue(person, kABPersonLastNameProperty, @"李", NULL);
// 通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL);
// 添加联系人
ABAddressBookAddRecord(book, person, NULL);
// 保存修改
ABAddressBookSave(book, NULL);
// 释放
CFRelease(person);
CFRelease(book);
八、添加一些复杂的属性
// 设置邮箱属性的内容
ABMultiValueRef email = ABMultiValueCreateMutable(kABStringPropertyType);
// 工作邮箱
ABMultiValueAddValueAndLabel(email, @"wok@qq.com", kABWorkLabel, NULL);
// 家庭邮箱
ABMultiValueAddValueAndLabel(email, @"home@qq.com", kABHomeLabel, NULL);
// 添加邮箱属性
ABRecordSetValue(person, kABPersonEmailProperty, email, NULL);
CFRelease(email);
九、添加群组的步骤
// 创建组
ABRecordRef group = ABGroupCreate();
// 设置组名
ABRecordSetValue(group, kABGroupNameProperty, @"家人", NULL);
// 通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL);
// 添加组
ABAddressBookAddRecord(book, group, NULL);
// 保存修改
ABAddressBookSave(book, NULL);
CFRelease(book);
CFRelease(group);
判断通讯录中的联系人是否有图片
取得图片数据(假如有的话)
设置联系人的图片数据
设置图片数据
if(ABPersonHasImageData(person)) {
NSData *data = (__bridge NSData *)ABPersonCopyImageData(person);
_imageView.image = [UIImage imageWithData:data];
}
//
// ViewController.m
// IOS_0323_访问通讯录
//
// Created by ma c on 16/3/23.
// Copyright © 2016年 博文科技. All rights reserved.
// #import "ViewController.h"
#import <AddressBook/AddressBook.h> @interface ViewController () - (IBAction)accessAllPeople;
- (IBAction)updatePeople;
- (IBAction)addPeople; @end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad]; [self requestAccessAddressBook]; } //请求访问通讯录
- (void)requestAccessAddressBook
{
//创建通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL); //请求访问通讯录权限
ABAddressBookRequestAccessWithCompletion(book, ^(bool granted, CFErrorRef error) {
if (granted) {
NSLog(@"允许访问");
// [self accessAddressBook];
}else{
NSLog(@"不允许访问");
} }); //释放资源
CFRelease(book);
} //访问通讯录信息
- (IBAction)accessAllPeople { [self accessAllPeopleWithC]; }
- (void)accessAllPeopleWithOC
{
//如果没有授权成功,直接返回
if (ABAddressBookGetAuthorizationStatus() != kABAuthorizationStatusAuthorized) return; //1.创建通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL); //2.获得通讯录中所有联系人
//桥接技术:
NSArray *allPeople = (__bridge NSArray *)ABAddressBookCopyArrayOfAllPeople(book); //3.遍历数组中所有联系人
for (int i = ; i < allPeople.count; i++) {
ABRecordRef record = (__bridge ABRecordRef)(allPeople[i]); NSString *firstName = (__bridge NSString *)(ABRecordCopyValue(record, kABPersonFirstNameProperty));
NSString *lastName = (__bridge NSString *)(ABRecordCopyValue(record, kABPersonLastNameProperty)); } //7.释放
CFRelease(book);
} - (void)accessAllPeopleWithC
{
//如果没有授权成功,直接返回
if (ABAddressBookGetAuthorizationStatus() != kABAuthorizationStatusAuthorized) return; //1.创建通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL); //2.获得通讯录中所有联系人
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(book); //3.遍历数组中所有联系人
CFIndex count = CFArrayGetCount(allPeople); for (CFIndex i = ; i < count; i++) {
//4.获得i这个位置对应的联系人(1个联系人 对应 1个)
ABRecordRef people = CFArrayGetValueAtIndex(allPeople, i); //5.取得联系人信息
CFStringRef firstName = ABRecordCopyValue(people, kABPersonFirstNameProperty);
CFStringRef lastName = ABRecordCopyValue(people, kABPersonLastNameProperty);
ABMultiValueRef phone = ABRecordCopyValue(people, kABPersonPhoneProperty); //6.输出
NSLog(@"%@ %@",lastName,firstName); //获得更详细的数据信息
CFArrayRef phones = ABMultiValueCopyArrayOfAllValues(phone);
CFIndex phoneCount = CFArrayGetCount(phones);
for (int j = ; j < phoneCount; j++) {
CFStringRef phoneLabel = ABMultiValueCopyLabelAtIndex(phone, j);
CFStringRef phoneValue = ABMultiValueCopyValueAtIndex(phone, j);
NSLog(@"%@,%@", phoneLabel, phoneValue); CFRelease(phoneLabel);
CFRelease(phoneValue);
} //释放
CFRelease(phones);
CFRelease(phone);
CFRelease(lastName);
CFRelease(firstName);
} //7.释放
CFRelease(allPeople);
CFRelease(book); } - (IBAction)updatePeople {
//如果没有授权成功,直接返回
if (ABAddressBookGetAuthorizationStatus() != kABAuthorizationStatusAuthorized) return; //1.创建通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL); //2.获得通讯录中所有联系人
NSArray *allPeople = (__bridge NSArray *)ABAddressBookCopyArrayOfAllPeople(book); ABRecordRef people = (__bridge ABRecordRef)(allPeople[]);
CFStringRef lastName = (__bridge CFStringRef)@"刘";
//3.修改姓
ABRecordSetValue(people, kABPersonLastNameProperty, lastName, NULL); //4.同步
ABAddressBookSave(book, NULL); //释放
CFRelease(book);
} - (IBAction)addPeople {
// 如果没有授权成功,直接返回
if (ABAddressBookGetAuthorizationStatus() != kABAuthorizationStatusAuthorized) return; // 1.创建新的联系人
ABRecordRef people = ABPersonCreate(); // 2.设置信息
ABRecordSetValue(people, kABPersonLastNameProperty, (__bridge CFStringRef)@"刘", NULL);
ABRecordSetValue(people, kABPersonFirstNameProperty, (__bridge CFStringRef)@"蛋疼", NULL); ABMultiValueRef phone = ABMultiValueCreateMutable(kABMultiStringPropertyType);
ABMultiValueAddValueAndLabel(phone, (__bridge CFStringRef)@"", kABPersonPhoneMainLabel, NULL);
ABMultiValueAddValueAndLabel(phone, (__bridge CFStringRef)@"", kABPersonPhoneMobileLabel, NULL);
ABMultiValueAddValueAndLabel(phone, (__bridge CFStringRef)@"", kABPersonPhoneIPhoneLabel, NULL);
ABRecordSetValue(people, kABPersonPhoneProperty, phone, NULL); // 3.添加联系人到通讯录
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL);
ABAddressBookAddRecord(book, people, NULL); ABAddressBookSave(book, NULL); // 4.释放
CFRelease(phone);
CFRelease(people);
CFRelease(book); }
@end
//
// ViewController.m
// 02-通讯录访问
//
// Created by apple on 13-9-14.
// Copyright (c) 2013年 itcast. All rights reserved.
// #import "ViewController.h"
#import <AddressBook/AddressBook.h> @interface ViewController () @end @implementation ViewController - (void)viewDidLoad
{
[super viewDidLoad]; // 获得状态
ABAuthorizationStatus status = ABAddressBookGetAuthorizationStatus(); // 获得所有的联系人数据
if (status == kABAuthorizationStatusAuthorized) {
[self getPersonImage];
}
} - (void)getPersonImage
{
// 1.获得通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL); // 2.获得通讯录实例中的所有联系人数组
CFArrayRef persons = ABAddressBookCopyArrayOfAllPeople(book); ABRecordRef person = CFArrayGetValueAtIndex(persons, );
if (ABPersonHasImageData(person)) {
NSData *data = (__bridge NSData *)(ABPersonCopyImageData(person)); _imageView.image = [UIImage imageWithData:data]; // [data writeToFile:@"/Users/apple/Desktop/abc.png" atomically:YES];
} // 释放资源
CFRelease(book);
CFRelease(persons);
} - (void)setPersonImage
{
// 1.获得通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL); // 2.获得通讯录实例中的所有联系人数组
CFArrayRef persons = ABAddressBookCopyArrayOfAllPeople(book); // 3.遍历所有的联系人数据
int count = CFArrayGetCount(persons); // 加载头像数据
UIImage *image = [UIImage imageNamed:@"test2.png"];
NSData *data = UIImagePNGRepresentation(image); for (int i = ; i<count; i++) {
// 获取一条通讯录记录(一个联系人\一个组)
ABRecordRef person = CFArrayGetValueAtIndex(persons, i); // 设置头像
ABPersonSetImageData(person, (__bridge CFDataRef)data, NULL);
} ABAddressBookSave(book, NULL); // 释放资源
CFRelease(book);
CFRelease(persons);
} #pragma mark - 添加含有联系人的组
- (void)addGroup2
{
// 1.获得通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL); /*
2.添加一个新的组(包含新人)
*/
ABRecordRef group = ABGroupCreate();
// 设置组名
ABRecordSetValue(group, kABGroupNameProperty, @"小学同学5", NULL);
ABAddressBookAddRecord(book, group, NULL);
ABAddressBookSave(book, NULL); /*
3.添加一个新的人
*/
ABRecordRef person = ABPersonCreate();
ABRecordSetValue(person, kABPersonLastNameProperty, @"李5", NULL);
ABRecordSetValue(person, kABPersonFirstNameProperty, @"lili5", NULL);
ABAddressBookAddRecord(book, person, NULL);
ABAddressBookSave(book, NULL); // 4.添加联系人到组中
ABGroupAddMember(group, person, NULL);
ABAddressBookSave(book, NULL); CFRelease(person);
CFRelease(group);
CFRelease(book);
} #pragma mark - 添加组
- (void)addGroup
{
// 1.创建一个新组
ABRecordRef group = ABGroupCreate();
// 设置组名
ABRecordSetValue(group, kABGroupNameProperty, @"大学同学", NULL); // 2.获得通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL);
ABAddressBookAddRecord(book, group, NULL); // 3.保存
ABAddressBookSave(book, NULL); CFRelease(group);
CFRelease(book);
} #pragma mark - 查询所有的组
- (void)findGroups
{
// 1.获得通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL); // 2.获取组
CFArrayRef groups = ABAddressBookCopyArrayOfAllGroups(book);
int count = CFArrayGetCount(groups); for (int i = ; i<count; i++) {
ABRecordRef group = CFArrayGetValueAtIndex(groups, i); CFStringRef name = ABRecordCopyValue(group, kABGroupNameProperty); NSLog(@"%@", name); CFRelease(name);
} CFRelease(groups);
CFRelease(book);
} #pragma mark - 修改联系人(全部人的姓都变为“刘”)
- (void)updatePersons
{
// 1.获得通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL); // 2.获得通讯录实例中的所有联系人数组
CFArrayRef persons = ABAddressBookCopyArrayOfAllPeople(book); // 3.遍历所有的联系人数据
int count = CFArrayGetCount(persons);
for (int i = ; i<count; i++) {
// 获取一条通讯录记录(一个联系人\一个组)
ABRecordRef person = CFArrayGetValueAtIndex(persons, i); ABRecordSetValue(person, kABPersonLastNameProperty, @"刘", NULL);
} ABAddressBookSave(book, NULL); // 释放资源
CFRelease(book);
CFRelease(persons);
} #pragma mark - 添加联系人
- (void)addPerson
{
// 1.创建一个新的联系人
ABRecordRef person = ABPersonCreate(); // 2.设置联系人的属性
ABRecordSetValue(person, kABPersonLastNameProperty, @"张", NULL);
ABRecordSetValue(person, kABPersonFirstNameProperty, @"飞", NULL); // 3.添加联系人到通讯录中
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL);
ABAddressBookAddRecord(book, person, NULL); // 4.保存修改
if(ABAddressBookHasUnsavedChanges(book)) { // 如果没有未保存的修改,就保存
ABAddressBookSave(book, NULL);
} // 5.释放资源
CFRelease(person);
CFRelease(book);
} #pragma mark - 查找所有的联系人 (简单属性)
- (void)findAllPersons
{
// CF的内存管理原则:只要函数中包含了Create、Copy等字眼,就主要release相应的实例 // 1.获得通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL); // 2.获得通讯录实例中的所有联系人数组
CFArrayRef persons = ABAddressBookCopyArrayOfAllPeople(book); // 3.遍历所有的联系人数据
int count = CFArrayGetCount(persons);
for (int i = ; i<count; i++) {
// 获取一条通讯录记录(一个联系人\一个组)
ABRecordRef person = CFArrayGetValueAtIndex(persons, i); // 获得用户的firstname (名)
CFStringRef firstaname = ABRecordCopyValue(person, kABPersonFirstNameProperty);
// 获得用户的lasttname (姓)
CFStringRef lasttaname = ABRecordCopyValue(person, kABPersonLastNameProperty); NSLog(@"%@ %@", lasttaname, firstaname); // 释放资源
CFRelease(firstaname);
CFRelease(lasttaname);
} // 释放资源
CFRelease(book);
CFRelease(persons);
} - (void)findAllPersons2
{
// 1.获得通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL); // 2.获得通讯录实例中的所有联系人数组
NSArray *persons = (__bridge NSArray *)ABAddressBookCopyArrayOfAllPeople(book); // 3.遍历所有的联系人数据
int count = persons.count;
for (int i = ; i<count; i++) {
// 获取一条通讯录记录(一个联系人\一个组)
ABRecordRef person = (__bridge ABRecordRef)persons[i]; // 获得用户的firstname (名)
NSString *firstaname = (__bridge NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
// 获得用户的lasttname (姓)
NSString *lasttaname = (__bridge NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty); NSLog(@"%@ %@", lasttaname, firstaname);
} // 释放资源
CFRelease(book);
} #pragma mark 复杂属性
- (void)findAllPersons3
{
// 1.获得通讯录实例
ABAddressBookRef book = ABAddressBookCreateWithOptions(NULL, NULL); // 2.获得通讯录实例中的所有联系人数组
CFArrayRef persons = ABAddressBookCopyArrayOfAllPeople(book); // 3.遍历所有的联系人数据
int count = CFArrayGetCount(persons);
for (int i = ; i<count; i++) {
// 获取一条通讯录记录(一个联系人\一个组)
ABRecordRef person = CFArrayGetValueAtIndex(persons, i); // 获得所有的地址
ABMultiValueRef addresses = ABRecordCopyValue(person, kABPersonAddressProperty);
// 获得第0个地址
CFDictionaryRef address0 = ABMultiValueCopyValueAtIndex(addresses, );
// 获得第0个地址的国家
CFStringRef conutry = CFDictionaryGetValue(address0, kABPersonAddressCountryKey);
NSLog(@"%@", conutry); // 获得邮件
ABMultiValueRef email = ABRecordCopyValue(person, kABPersonEmailProperty); // 获得邮箱类型
CFStringRef label0 = ABMultiValueCopyLabelAtIndex(email, );
CFStringRef label1 = ABMultiValueCopyLabelAtIndex(email, );
// 获得本地化标签
CFStringRef newLable0 = ABAddressBookCopyLocalizedLabel(label0);
CFStringRef newLable1 = ABAddressBookCopyLocalizedLabel(label1);
// 获得邮箱地址值
CFStringRef value0 = ABMultiValueCopyValueAtIndex(email, );
CFStringRef value1 = ABMultiValueCopyValueAtIndex(email, ); NSLog(@"%@ - %@", newLable0, value0);
NSLog(@"%@ - %@", newLable1, value1); // CFRelease(label0);
// CFRelease(label1);
// CFRelease(newLable0);
// CFRelease(newLable1);
// CFRelease(value0);
// CFRelease(value1);
} // 释放资源
CFRelease(book);
CFRelease(persons);
}
@end
IOS-通讯录的更多相关文章
- iOS 通讯录空格
iOS 通讯录联系人出现 ASCII 码值为 160 的空格 NOTE: 这里的"空格"是指 在通讯录中取出的联系人中带有特殊空格 带有特殊空格的字符串 " ...
- Xamarin.Forms读取并展示Android和iOS通讯录 - TerminalMACS客户端
Xamarin.Forms读取并展示Android和iOS通讯录 - TerminalMACS客户端 本文同步更新地址: https://dotnet9.com/11520.html https:// ...
- iOS 通讯录-获取联系人属性
内容均来自关东升老师的ios开发指南 上一篇写了联系人框架的一些必须知道的知识 如今写一下读取联系人数据相关操作 要读取通讯录数据库 须要 创建通讯录对象 查询获取数据(全部或者部分) 获取通讯录某一 ...
- iOS通讯录相关知识-浅析
本文来自于:贞娃儿的博客 http://blog.sina.com.cn/zhenwawaer 在开发一些应用中,我们如果需要iPhone设备中的通讯录信息.或者,需要开发通讯录相关的一些功能.那 ...
- IOS 通讯录 (访问,添加,修改)
如何访问用户的通讯录 在iOS中,有2个框架可以访问用户的通讯录 AddressBookUI.framework 提供了联系人列表界面.联系人详情界面.添加联系人界面等 一般用于选择联系人 Add ...
- IOS通讯录的隐藏标签【电话】的特殊功能(在IOS11已失效)
这功能比较适合有强迫症,爱折腾的人哈!! 规范了通讯录标签,以后可以轻松的知道别人是用短号还是亲情网给你打电话. 如果是长号还可以显示归属地. 也许从IOS8(不太清楚)开始自带了号码归属地显示功能, ...
- iOS 通讯录编程【总结】
第一大块儿:读取通讯录 1.iOS 6以上系统,争取获取用户允许: 初始化的时候须要推断.设备是否授权 -(id)init{ self = [super init]; [self createdABH ...
- iOS 通讯录基础
iOS 6 之后应用訪问通讯录须要获得用户授权,而且仅仅授权一次,即使卸载了之后再安装.也不用再次授权. 开发通讯录应用须要两个框架: 1.ABAddressBook 主要用于提供訪问通讯录中 ...
- iOS通讯录整合,兼容iOS789写法,附demo
苹果的通讯录功能在iOS7,iOS8,iOS9 都有着一定的不同,iOS7和8用的是 <AddressBookUI/AddressBookUI.h> ,但是两个系统版本的代理方法有一些变化 ...
- iOS通讯录开发
场景一:直接选择一个联系人的电话号码 这里不需要先获取所有的联系人自己做联系人列表,直接使用系统自带的AddressBookUI/ABPeoplePickerNavigationController. ...
随机推荐
- java配置文件properties,yml,一般文件
JAVA编写配置文件的几种方式: JAVA配置文件,一般都放在resource目录下,无论是下面提到的properties.yml还是普通的txt等文件. 在打成jar包之后,只需要jar包程序就可运 ...
- struts 多文件上传 annotation注解(零配置)+ ajaxfileupload + 异步 版本
[本文简介] struts 多文件上传.基于”零配置“+"ajaxfileupload" 的一个简单例子. [导入依赖jar包] jquery-1.7.2.js : http:// ...
- 开发微信公众平台--新建新浪云sae部署server
创建新浪云计算应用 申请账号 我们使用SAE新浪云计算平台作为server资源.而且申请PHP环境+MySQL数据库作为程序执行环境. 申请地址:百度搜sae ,使用新浪微博账号能够直接登录SAE,登 ...
- mysql的-F与master-data理解(一个小型的big-log恢复)
例子: 使用mysqlbin-log恢复,有两种情况,一个是停数据库,一个是不停 在不停数据库的情况下,为了防止新的写入,需要将bin-log切割,然后新的数据会保存在新的bin-log里面 在此之前 ...
- change the color of a disabled TEdit?
change the color of a disabled TEdit? Author: P. Below Category: VCL {Question:How can I change the ...
- django生成json
好方便啊……list什么的一下都变成json了呢! import json from django.core.serializers.json import DjangoJSONEncoder def ...
- 微信小程序组件form
表单组件form:官方文档 Demo Code: Page({ formSubmit: function(e) { console.log('form发生了submit事件,携带数据为:', e.de ...
- Wannafly交流赛1_B_硬币【数学】
Wannafly交流赛1_B_硬币[数学] 链接:https://www.nowcoder.com/acm/contest/69/B 来源:牛客网 题目描述 蜥蜴的生日快到了,就在这个月底! 今年,蜥 ...
- Codeforces Round #396 (Div. 2) C. Mahmoud and a Message
地址:http://codeforces.com/contest/766/problem/C 题目: C. Mahmoud and a Message time limit per test 2 se ...
- uva 11752 The Super Powers (数论+枚举)
题意:找出1~2^64-1中 能写成至少两个数的幂形式的数,再按顺序输出 分析:只有幂是合数的数才是符合要求的.而幂不会超过64,预处理出64以内的合数. 因为最小的合数是4,所以枚举的上限是2的16 ...