ACM?java???
???????????? ???????[ 2014/2/8 10:46:34 ] ???????????? ???????
????3. ?????????
????java???????String??????????????????????????????.
?????????
import java.io.*;
import java.math.*;
import java.util.*;
import java.text.*;
public class Main
{
public static void main(String[] args)
{
int i;
Scanner cin = new Scanner (new BufferedInputStream(System.in));
String st = "abcdefg";
System.out.println(st.charAt(0)); // st.charAt(i)????st[i].
char [] ch;
ch = st.toCharArray(); // ????????????????.
for (i = 0; i < ch.length; i++) ch[i] += 1;
System.out.println(ch); // ?????“bcdefgh”.
if (st.startsWith("a")) // ??????????'0'???.
{
st = st.substring(1); // ????1λ???copy(??????0λ).
}
}
}
|
????4. ?????
????BigInteger??BigDecimal???????acmer???java????????
??????????add?? subtract?? divide?? mod?? compareTo??????м?????????????BigInteger(BigDecimal)??BigInteger(BigDecimal)?????????????????int(double)????????BigInteger(BigDecimal)???ú???BigInteger.valueOf().
?????????
import java.io.*;
import java.math.*;
import java.util.*;
import java.text.*;
public class Main
{
public static void main(String[] args)
{
Scanner cin = new Scanner (new BufferedInputStream(System.in));
int a = 123?? b = 456?? c = 7890;
BigInteger x?? y?? z?? ans;
x = BigInteger.valueOf(a); y = BigInteger.valueOf(b); z = BigInteger.valueOf(c);
ans = x.add(y); System.out.println(ans);
ans = z.divide(y); System.out.println(ans);
ans = x.mod(z); System.out.println(ans);
if (ans.compareTo(x) == 0) System.out.println("1");
}
}
|
????5. ???????
????java??????????????
??????????
????String st = Integer.toString(num?? base); // ??num????10??????????base?????st(base <= 35).
????int num = Integer.parseInt(st?? base); // ??st????base????????10?????int(parseInt??????????????????????????????????????????????).
????BigInter m = new BigInteger(st?? base); // st?????????base??st?????.
????6. ????
??????????Arrays.sort();?????????????壬??C++??д??cmp?????????java?????????????????????????
?????????
import java.io.*;
import java.math.*;
import java.util.*;
import java.text.*;
public class Main
{
public static void main(String[] args)
{
Scanner cin = new Scanner (new BufferedInputStream(System.in));
int n = cin.nextInt();
int a[] = new int [n];
for (int i = 0; i < n; i++) a[i] = cin.nextInt();
Arrays.sort(a);
for (int i = 0; i < n; i++) System.out.print(a[i] + " ");
}
}
|
????7. POJ?????????????
????POJ 1131 1205 1220 1405 1503 1604 1894 2084 2305 2325 2389 2413 3101 3199
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11