手机app怎么制作流程图,wordpress适合seo,一个电商网站建设需要哪些技术,wordpress首页文章摘要思路#xff1a; 最好想的是用hashmap#xff0c;当然用c的话也可以用两个数组#xff0c;一个数组用于存放字符串#xff0c;自动对应ACSII码#xff0c;一个将对应ACSII码的数字对应其下标#xff0c;当然这也是用的映射的思想。
import java.util.*;public class Cac… 思路 最好想的是用hashmap当然用c的话也可以用两个数组一个数组用于存放字符串自动对应ACSII码一个将对应ACSII码的数字对应其下标当然这也是用的映射的思想。
import java.util.*;public class Caculatenumber {public static void main(String[]args){Scanner scannew Scanner(System.in);String strscan.nextLine();scan.close();HashMapCharacter,Integer hashnew HashMapCharacter,Integer();int nstr.length();int count0;char[] anew char[1024];for(int i0;in;i){a[i]str.charAt(i);}for(int i0;in;i){hash.put(a[i], 1);}System.out.println(hash.size());// int nstr.length();// char[] anew char[1024];// int[] mapnew int[1024];// int num0;// for(int i0;in;i){// a[i]str.charAt(i);// }// for(int i0;in;i){// map[a[i]]1;// }// for(int i0;in;i){// if(map[i]1){// num;// }// }// System.out.println(num);}
}定义
MapString ,String map new HashMapString ,String();
方法 1.put(Object key, Object value) //添加键值对 2.putAll(Collection c) //添加指定的映射关系到目标映射关系 3.get(Object key) //根据键来获取对应的值 4.getOrDefault(Object key, V defaultValue) //map中存在key则使用对应的value否则使用defaultValue 4.containsKey(Object key) //是否有指定key的映射 5.containsValue(Object value) //是否有指定value的映射 6.remove(Object key) //删除该键值对 7.values() //返回所有值返回形式为Collection 8.isEmpty() //测试映射是否为空 10.size() //返回大小 思路最小公因数等于两者相乘除于最大公倍数可用经典的辗转相除求最大公倍数
#include stdio.h
main(){int a,b,c;scanf(%d,a);scanf(%d,b);ca*b;while (a%b) { //辗转相除求最小公约数int za%b;ab;bz;}printf(%d,c/b);
}