mình nộp bài
bài 1:
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>bai1: (move your mouse to reveal the content)</noscript>
bai1: (open)
bai1: (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:
[color=#000000]
import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]lession9_bai1[/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]){ [/color][color=#0000bb]scanner input [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]int n [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]string arrstudent[/color][color=#007700][]; [/color][color=#0000bb]string findstu [/color][color=#007700]= [/color][color=#dd0000]""[/color][color=#007700]; [/color][color=#0000bb]lession9_bai1 find_arr [/color][color=#007700]= new [/color][color=#0000bb]lession9_bai1[/color][color=#007700](); do{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap vao so sinh vien trong mang: "[/color][color=#007700]); [/color][color=#0000bb]n[/color][color=#007700]=[/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if([/color][color=#0000bb]n[/color][color=#007700]<=[/color][color=#0000bb]0[/color][color=#007700]) [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"so sinh vien khong duoc <=0. vui long nhap lai"[/color][color=#007700]); }while([/color][color=#0000bb]n[/color][color=#007700]<=[/color][color=#0000bb]0[/color][color=#007700]); [/color][color=#0000bb]arrstudent [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]]; [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#ff8000]//ðoi voi chuoi thi phai khoi tao gia tri dau tien [/color][color=#007700]for([/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]<[/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap sinh vien thu "[/color][color=#007700]+ ([/color][color=#0000bb]i[/color][color=#007700]+[/color][color=#0000bb]1[/color][color=#007700]) +[/color][color=#dd0000]": "[/color][color=#007700]); [/color][color=#0000bb]arrstudent[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap ten sinh vien muon tim kiem: "[/color][color=#007700]); [/color][color=#0000bb]findstu [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); if([/color][color=#0000bb]find_arr[/color][color=#007700].[/color][color=#0000bb]findstudent[/color][color=#007700]([/color][color=#0000bb]findstu[/color][color=#007700], [/color][color=#0000bb]arrstudent[/color][color=#007700]) == -[/color][color=#0000bb]1[/color][color=#007700]) [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ten sinh vien muon tim khong co trong mang."[/color][color=#007700]); else [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ten sinh vien muon tim la: "[/color][color=#007700]+[/color][color=#0000bb]arrstudent[/color][color=#007700][[/color][color=#0000bb]find_arr[/color][color=#007700].[/color][color=#0000bb]findstudent[/color][color=#007700]([/color][color=#0000bb]findstu[/color][color=#007700], [/color][color=#0000bb]arrstudent[/color][color=#007700])]); } public [/color][color=#0000bb]int findstudent[/color][color=#007700]([/color][color=#0000bb]string sv[/color][color=#007700], [/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]arr[/color][color=#007700]){ for([/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]<[/color][color=#0000bb]arr[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++){ if([/color][color=#0000bb]arr[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#0000bb]sv[/color][color=#007700])) return [/color][color=#0000bb]i[/color][color=#007700]; } return -[/color][color=#0000bb]1[/color][color=#007700]; }}[/color]
</blockquote></div>
</div>
</div>
bài 2:
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>bai2: (move your mouse to reveal the content)</noscript>
bai2: (open)
bai2: (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:
[color=#000000]
import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]lession9_bai2[/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]){ [/color][color=#0000bb]scanner input [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]lession9_bai2 sx [/color][color=#007700]= new [/color][color=#0000bb]lession9_bai2[/color][color=#007700](); [/color][color=#0000bb]int n [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; do{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap vao so phan tu day so nguyen: "[/color][color=#007700]); [/color][color=#0000bb]n [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if([/color][color=#0000bb]n [/color][color=#007700]< [/color][color=#0000bb]0[/color][color=#007700]) [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"so phan tu day so nguyen khong duoc phep < 0."[/color][color=#007700]); }while([/color][color=#0000bb]n[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700]); [/color][color=#0000bb]int[/color][color=#007700][] [/color][color=#0000bb]arrayint [/color][color=#007700]= new [/color][color=#0000bb]int[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]]; for([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap vao phan tu thu "[/color][color=#007700]+ ([/color][color=#0000bb]i[/color][color=#007700]+[/color][color=#0000bb]1[/color][color=#007700]) +[/color][color=#dd0000]": "[/color][color=#007700]); [/color][color=#0000bb]arrayint[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } [/color][color=#0000bb]sx[/color][color=#007700].[/color][color=#0000bb]sapxeptang[/color][color=#007700]([/color][color=#0000bb]arrayint[/color][color=#007700], [/color][color=#0000bb]n[/color][color=#007700]); } public [/color][color=#0000bb]void sapxeptang[/color][color=#007700]([/color][color=#0000bb]int[/color][color=#007700][] array, [/color][color=#0000bb]int n[/color][color=#007700]){ [/color][color=#0000bb]int temp[/color][color=#007700]; for([/color][color=#0000bb]int i [/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]<[/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++){ for([/color][color=#0000bb]int j[/color][color=#007700]=[/color][color=#0000bb]i[/color][color=#007700]+[/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]<[/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++){ if(array[[/color][color=#0000bb]i[/color][color=#007700]] > array[[/color][color=#0000bb]j[/color][color=#007700]]){ [/color][color=#0000bb]temp [/color][color=#007700]= array[[/color][color=#0000bb]j[/color][color=#007700]]; array[[/color][color=#0000bb]j[/color][color=#007700]] = array[[/color][color=#0000bb]i[/color][color=#007700]]; array[[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]temp[/color][color=#007700]; } } } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"xuat ra mang so nguyen tang dan: "[/color][color=#007700]); [/color][color=#0000bb]xuatmang[/color][color=#007700](array); } public [/color][color=#0000bb]void xuatmang[/color][color=#007700]([/color][color=#0000bb]int[/color][color=#007700][] array){ for([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< array.[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print(array[[/color][color=#0000bb]i[/color][color=#007700]] + [/color][color=#dd0000]" "[/color][color=#007700]); }}[/color]
</blockquote></div>
</div>
</div>
bài 3:
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>bai3: (move your mouse to reveal the content)</noscript>
bai3: (open)
bai3: (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:
[color=#000000]
import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]lession9_bai3[/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]){ [/color][color=#0000bb]scanner input [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]int m[/color][color=#007700], [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]int[/color][color=#007700][][] [/color][color=#0000bb]array1[/color][color=#007700], [/color][color=#0000bb]array2[/color][color=#007700], [/color][color=#0000bb]arraytong[/color][color=#007700]; [/color][color=#0000bb]lession9_bai3 bai [/color][color=#007700]= new [/color][color=#0000bb]lession9_bai3[/color][color=#007700](); do{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap vao so hang trong mang: "[/color][color=#007700]); [/color][color=#0000bb]m [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if([/color][color=#0000bb]m [/color][color=#007700]< [/color][color=#0000bb]0[/color][color=#007700]) [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"so hang trong mang khong <0."[/color][color=#007700]); }while([/color][color=#0000bb]m[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700]); do{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap vao so cot trong mang: "[/color][color=#007700]); [/color][color=#0000bb]n [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if([/color][color=#0000bb]n[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700]) [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"so cot trong mang khong < 0"[/color][color=#007700]); }while([/color][color=#0000bb]n[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700]); [/color][color=#0000bb]array1 [/color][color=#007700]= new [/color][color=#0000bb]int[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]][[/color][color=#0000bb]m[/color][color=#007700]]; [/color][color=#0000bb]array2 [/color][color=#007700]= new [/color][color=#0000bb]int[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]][[/color][color=#0000bb]m[/color][color=#007700]]; [/color][color=#0000bb]arraytong [/color][color=#007700]= new [/color][color=#0000bb]int[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]][[/color][color=#0000bb]m[/color][color=#007700]]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap mang thu 1: "[/color][color=#007700]); [/color][color=#0000bb]bai[/color][color=#007700].[/color][color=#0000bb]nhapmang[/color][color=#007700]([/color][color=#0000bb]array1[/color][color=#007700], [/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]m[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap mang thu 2: "[/color][color=#007700]); [/color][color=#0000bb]bai[/color][color=#007700].[/color][color=#0000bb]nhapmang[/color][color=#007700]([/color][color=#0000bb]array2[/color][color=#007700], [/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]m[/color][color=#007700]); [/color][color=#0000bb]bai[/color][color=#007700].[/color][color=#0000bb]tinhtong[/color][color=#007700]([/color][color=#0000bb]array1[/color][color=#007700], [/color][color=#0000bb]array2[/color][color=#007700], [/color][color=#0000bb]arraytong[/color][color=#007700], [/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]m[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"tong 2 ma tran duoc: "[/color][color=#007700]); [/color][color=#0000bb]bai[/color][color=#007700].[/color][color=#0000bb]xuatmang[/color][color=#007700]([/color][color=#0000bb]arraytong[/color][color=#007700], [/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]m[/color][color=#007700]); } public [/color][color=#0000bb]void nhapmang[/color][color=#007700]([/color][color=#0000bb]int [/color][color=#007700]array[][], [/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]int m[/color][color=#007700]){ [/color][color=#0000bb]scanner input [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); for([/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) for([/color][color=#0000bb]int j [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]m[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"phan tu ["[/color][color=#007700]+[/color][color=#0000bb]i[/color][color=#007700]+[/color][color=#dd0000]"]["[/color][color=#007700]+[/color][color=#0000bb]j[/color][color=#007700]+[/color][color=#dd0000]"]: "[/color][color=#007700]); array[[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]] = [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } } public [/color][color=#0000bb]void xuatmang[/color][color=#007700]([/color][color=#0000bb]int [/color][color=#007700]array[][], [/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]int m[/color][color=#007700]){ for([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++){ for([/color][color=#0000bb]int j [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]m[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print(array[[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]]+[/color][color=#dd0000]" "[/color][color=#007700]); } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
"[/color][color=#007700]); } } public [/color][color=#0000bb]void tinhtong[/color][color=#007700]([/color][color=#0000bb]int array1[/color][color=#007700][][], [/color][color=#0000bb]int array2[/color][color=#007700][][], [/color][color=#0000bb]int tong[/color][color=#007700][][], [/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]int m[/color][color=#007700]){ for([/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) for([/color][color=#0000bb]int j [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]m[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) [/color][color=#0000bb]tong[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]] = [/color][color=#0000bb]array1[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]] + [/color][color=#0000bb]array2[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]]; }}[/color]
</blockquote></div>
</div>
</div>
thanks.
Khu dự án Diamond Alnata Plus phát triển bởi Gamuda Land thiết kế hợp lý nằm trung tâm thông gió tự nhiên. Diamond Alnata Plus Tân Phú thiết kế hợp lý sống đích thực ngay giữa trung tâm. Căn hộ cách...
Khu dự án Diamond Alnata Plus giáp trung tâm